home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / modula2 / tutorial / programs / chardemo.mod < prev    next >
Text File  |  1993-03-14  |  1KB  |  33 lines

  1.                                          (* Chapter 3 - Program 6 *)
  2. MODULE CharDemo;
  3.  
  4. FROM InOut IMPORT WriteLn, Write, WriteString;
  5.  
  6. VAR Char1, Char2, Dog3, Cat4 : CHAR;
  7.     Index                    : INTEGER;
  8.  
  9. BEGIN
  10.  
  11.    Char1 := 'A';                     (* This is a capitol A      *)
  12.    Char2 := "T";                     (* This is a capitol T      *)
  13.    Index := ORD(Char1) + 2;          (* The numerical value of A
  14.                                         plus 2 = the value of C  *)
  15.    Dog3 := CHR(Index);               (* The letter C             *)
  16.    Cat4 := '"';                      (* The quotation mark       *)
  17.  
  18.    WriteString("The characters can spell ");
  19.    Write(Cat4);
  20.    Write(Dog3);
  21.    Write(Char1);
  22.    Write(Char2);
  23.    Char1 := "S";                     (* Change to the letter S   *)
  24.    Write(Char1);
  25.    Write(Cat4);
  26.    WriteLn;
  27.  
  28.    Char1 := 65C;                       (* This sets Char1 to 'A' *)
  29.    Char1 := 'a';                       (* This sets Char1 to 'a' *)
  30.    Char2 := CAP(Char1);                (* This sets Char2 to 'A' *)
  31.  
  32. END CharDemo.
  33.