Fill a matrix with random numbers

FlamingClaw 0 Tallied Votes 233 Views Share

just see it...

(*Creating a matrix array and fill with random numbers  2009.03*)
Program MATRIX_BY_FLAMINGCLAW;
Uses Crt;
Var I1,I2:BYTE;

   MATRIX:ARRAY[1..3,1..4]OF BYTE;{this array consist of 3 lines and 4 pillars}
Begin
     FOR I1:=1 TO 3 DO
         FOR I2:=1 TO 4 DO WritelN('MATRIX[',I1,',',I2,']= ',Random(100));

     ReadKey;
End.
(*
returned values:

MATRIX[1,1]=11
MATRIX[1,2]=23
MATRIX[1,3]=46
MATRIX[1,4]=34

MATRIX[2,1]=36
MATRIX[2,2]=42
MATRIX[2,3]=67
MATRIX[2,4]=21

MATRIX[3,1]=12
MATRIX[3,2]=53
MATRIX[3,3]=72
MATRIX[3,4]=80

*)


(*
  Matrix[1..3,1..4]of Byte;   {3 lines} {4 pillars}

      Pillars          L
  1.  [11][23][46][34] i
  2.  [36][42][67][21] n
  3.  [12][53][72][80] e
       1.  2.  3.  4.  s

  If the question is that MATRIX[2,2]:=?
  Then the answer is  42
  MATRIX[3,4]:=?  the answer is 80
  so simple,not?
*)