home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog4 / revers.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  769 b   |  38 lines

  1.                                        -- Chapter 18 - Program 5
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure Revers is
  6.  
  7.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  8.    use Int_IO;
  9.  
  10.    type MY_ARRAY is array(3..10) of INTEGER;
  11.  
  12.    Store_Here : MY_ARRAY := (3, 16, -5, 6, 12, 66, -13, 57);
  13.    Another    : MY_ARRAY;
  14.  
  15.    function Reverse_Array(Data : MY_ARRAY) return MY_ARRAY is
  16.       Temp : MY_ARRAY;
  17.    begin
  18.       for Index in Data'RANGE loop
  19.          Temp(Index) := Data(Data'FIRST + Data'LAST - Index);
  20.       end loop;
  21.       return Temp;
  22.    end Reverse_Array;
  23.  
  24. begin
  25.  
  26.    Another := Reverse_Array(Store_Here);
  27.    Another := Reverse_Array(Another);
  28.  
  29. end Revers;
  30.  
  31.  
  32.  
  33.  
  34. -- Result of Execution
  35.  
  36. --    (No output from this program.)
  37.  
  38.