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

 
Output of file : ARRAYS.MOD contained in archive : M2TUTOR.ZIP
(* Chapter 6 - Program 1 *)
MODULE Arrays;

FROM InOut IMPORT WriteString, WriteCard, WriteLn;

VAR Index : CARDINAL;
Automobiles : ARRAY [1..12] OF CARDINAL;

BEGIN (* main program *)
FOR Index := 1 TO 12 DO
Automobiles[Index] := Index + 10;
END;
Automobiles[7] := 54; (* example, change one value of array *)
WriteString("This is the first program with an array.");
WriteLn;
WriteLn; (* end of data initialization *)

FOR Index := 1 TO 12 DO (* display the data now *)
WriteString("Automobile number");
WriteCard(Index,3);
WriteString(" has the value of");
WriteCard(Automobiles[Index],3);
WriteLn;
END;
END Arrays.




(* Result of execution

This is the first example program with an array.

Automobile number 1 has the value of 11
Automobile number 2 has the value of 12
Automobile number 3 has the value of 13
Automobile number 4 has the value of 14
Automobile number 5 has the value of 15
Automobile number 6 has the value of 16
Automobile number 7 has the value of 54
Automobile number 8 has the value of 18
Automobile number 9 has the value of 19
Automobile number 10 has the value of 20
Automobile number 11 has the value of 21
Automobile number 12 has the value of 22

*)


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