Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : CHARDEMO.MOD

 
Output of file : CHARDEMO.MOD contained in archive : M2TUTOR.ZIP
(* Chapter 3 - Program 7 *)
MODULE CharDemo;

FROM InOut IMPORT WriteLn, Write, WriteString;

VAR Char1, Char2, Dog3, Cat4 : CHAR;
Index : INTEGER;

BEGIN

Char1 := 'A'; (* This is a capital A *)
Char2 := "T"; (* This is a capital T *)
Index := ORD(Char1) + 2; (* The numerical value of A
plus 2 = the value of C *)
Dog3 := CHR(Index); (* The letter C *)
Cat4 := '"'; (* The quotation mark *)

WriteString("The characters can spell ");
Write(Cat4);
Write(Dog3);
Write(Char1);
Write(Char2);
Char1 := "S"; (* Change to the letter S *)
Write(Char1);
Write(Cat4);
WriteLn;

Char1 := 65C; (* This sets Char1 to 'A' *)
Char1 := 'a'; (* This sets Char1 to 'a' *)
Char2 := CAP(Char1); (* This sets Char2 to 'A' *)

END CharDemo.




(* Result of execution

The characters can spell "CATS"

*)



  3 Responses to “Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : CHARDEMO.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/