home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
pascal
/
pascsrc.arc
/
ARRAYS2.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-01-15
|
1KB
|
38 lines
(* Chapter 6 - Program 2 *)
program Multiple_Arrays;
var Index,Count : integer;
Checkerboard : array[1..8] of array[1..8] of integer;
Value : array[1..8,1..8] of integer;
begin (* Main program *)
for Index := 1 to 8 do begin (* index loop *)
for Count := 1 to 8 do begin
Checkerboard[Index,Count] := Index + 3*Count;
Value[Index,Count] := Index + 2*Checkerboard[Index,Count];
end;
end; (* of index loop *)
Writeln(' Output of checkerboard');
Writeln;
for Index := 1 to 8 do begin
for Count := 1 to 8 do
Write(Checkerboard[Index,Count]:7);
Writeln;
end;
Value[3,5] := -1; (* change some of the value matrix *)
Value[3,6] := 3;
Value[Value[3,6],7] := 2; (* This is the same as writing
Value[3,7] := 2; *)
for Count := 1 to 3 do
Writeln; (* Three blank lines *)
Writeln('Output of value');
Writeln;
for Count := 1 to 8 do begin
for Index := 1 to 8 do
Write(Value[Count,Index]:7);
Writeln;
end;
end. (* of main program *)