home *** CD-ROM | disk | FTP | other *** search
/ ftp.ee.pdx.edu / 2014.02.ftp.ee.pdx.edu.tar / ftp.ee.pdx.edu / pub / users / Harry / compilers / p3 / tst / arrays2.pcat < prev    next >
Text File  |  2005-10-24  |  677b  |  34 lines

  1. program is
  2.   type T is array of integer;
  3.   procedure echo (q:integer) : integer is
  4.     begin
  5.       write(q);
  6.       return q;
  7.     end;
  8.   procedure report (a:T) is
  9.     begin
  10.       write (a[0], " ", a[10], " ", a[20]);
  11.     end;
  12.   procedure change (a:T) is
  13.     begin
  14.       a[0] := 888;
  15.       a[20] := 777;
  16.       report(a);
  17.     end;
  18.   var x, y, z, w := 10;
  19.   var a := T {{ 10 of 0, 10 of 1, 10 of 2 }};
  20.   var b := T {{ x of 10, 10 of y, z of w }};
  21.   var c := T {{ echo(10) of echo(0), echo(20) of echo(1), echo(30) of echo(2) }};
  22.   begin    
  23.     report(a);
  24.     report(b);
  25.     report(c);
  26.     change(a);
  27.     change(b);
  28.     change(c);
  29.     report(a);
  30.     report(b);
  31.     report(c);
  32.   end;
  33.  
  34.