*/
Know a good article or link that we're missing? Submit it!
*/

View \ARRAYS2.PAS

This is the second disk of the PASCAL TUTOR system. It has the

Submitted By: WEBMASTER
Rating: (Not rated) (Rate It)


(* 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 *)

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.