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

 
Output of file : ARRAYS2.MOD contained in archive : M2TUTOR.ZIP
(* Chapter 6 - Program 2 *)
MODULE Arrays2;

FROM InOut IMPORT WriteString, WriteInt, WriteLn;

VAR Index, Count : CARDINAL;
Checkerboard : ARRAY[1..8] OF ARRAY[1..8] OF CARDINAL;
Value : ARRAY[1..8],[1..8] OF CARDINAL;

BEGIN
FOR Index := 1 TO 8 DO
FOR Count := 1 TO 8 DO
Checkerboard[Index,Count] := Index + 3*Count;
Value[Index,Count] := Index + 2*Checkerboard[Index,Count];
END; (* of Count loop *)
END; (* of Index loop *)

WriteString("Output of checkerboard");
WriteLn;
FOR Index := 1 TO 8 DO
FOR Count := 1 TO 8 DO
WriteInt(Checkerboard[Index,Count],6);
END; (* of Count loop *)
WriteLn;
END; (* of Index loop *)

Value[3,5] := 77; (* change a few of the values *)
Value[3,6] := 3;
Value[Value[3,6],7] := 2; (* same as Value[3,7] := 2; *)

WriteLn;
WriteString("Output of Value matrix");
WriteLn;
FOR Count := 1 TO 8 DO
FOR Index := 1 TO 8 DO
WriteInt(Value[Count,Index],6);
END; (* of Index loop *)
WriteLn;
END; (* of Count loop *)
END Arrays2.




(* Result of execution

Output of checkerboard
4 7 10 13 16 19 22 25
5 8 11 14 17 20 23 26
6 9 12 15 18 21 24 27
7 10 13 16 19 22 25 28
8 11 14 17 20 23 26 29
9 12 15 18 21 24 27 30
10 13 16 19 22 25 28 31
11 14 17 20 23 26 29 32

Output of Value matrix
9 15 21 27 33 39 45 51
12 18 24 30 36 42 48 54
15 21 27 33 77 3 2 57
18 24 30 36 42 48 54 60
21 27 33 39 45 51 57 63
24 30 36 42 48 54 60 66
27 33 39 45 51 57 63 69
30 36 42 48 54 60 66 72

*)



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