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

 
Output of file : CH03E1.MOD contained in archive : M2TUTOR.ZIP
(* Chapter 3 - Programming exercise 1 *)
MODULE CH03E1;

FROM InOut IMPORT WriteString, WriteLn, WriteCard, Write;

VAR Lettera : CHAR;
Letterz : CHAR;
Number0 : CHAR;
Number9 : CHAR;
La, Lz, N0, N9 : CARDINAL;

BEGIN

Lettera := 'a';
Letterz := 'z';
Number0 := '0';
Number9 := '9';

La := ORD(Lettera);
Lz := ORD(Letterz);
N0 := ORD(Number0);
N9 := ORD(Number9);

WriteString("The character ");
Write(Lettera);
WriteString(" has the value of ");
WriteCard(La,2);
WriteLn;

WriteString("The character ");
Write(Letterz);
WriteString(" has the value of ");
WriteCard(Lz,2);
WriteLn;

WriteString("The character ");
Write(Number0);
WriteString(" has the value of ");
WriteCard(N0,2);
WriteLn;

WriteString("The character ");
Write(Number9);
WriteString(" has the value of ");
WriteCard(N9,2);
WriteLn;

END CH03E1.




(* Result of execution

The character a has the value of 97
The character z has the value of 122
The character 0 has the value of 48
The character 9 has the value of 57

*)



  3 Responses to “Category : Modula II Source Code
Archive   : M2TUTOR.ZIP
Filename : CH03E1.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/