home *** CD-ROM | disk | FTP | other *** search
- -- Chapter 10 - Program 6
- with Text_IO;
- use Text_IO;
-
- procedure ArryInit is
-
- package Int_IO is new Text_IO.Integer_IO(INTEGER);
- use Int_IO;
-
- type MY_ARRAY is array(1..5) of INTEGER;
-
- Total : MY_ARRAY := (12, 27, -13, 122, 44);
- First : MY_ARRAY := (1 => 14, 2 => 57, 3=> 111,
- 5 => -27, 4 => 21);
-
- Another : MY_ARRAY := (2 => 13, 5 => 57, others => 3);
-
- One_More : MY_ARRAY := (2..4 => 13, 1 | 5 => 27);
-
- type MATRIX is array(INTEGER range 1..3,
- INTEGER range 1..4) of INTEGER;
-
- Square_Board : MATRIX := ((4, 7, 3, 5),
- (3, 8, 2, 0),
- (1, 5, 9, 9));
-
- Checker_Board : MATRIX := (2 => (3, 8, 2, 0),
- 3 => (1, 5, 9, 9),
- 1 => (4, 7, 3, 5));
-
- Chess_Board : MATRIX := (2 => (3, 8, 2, 0),
- 3 => (1, 5, 9, 9),
- 1 => (4 => 5, 2 => 7, 1 => 4, 3 => 3));
-
- begin
-
- if Square_Board = Checker_Board then
- Put_Line("The two arrays are equal.");
- end if;
-
- if Chess_Board = Square_Board then
- Put_Line(" and so are the other two.");
- end if;
-
- end ArryInit;
-
-
-
-
- -- Result of execution
-
- -- The two arrays are equal.
- -- and so are the other two.
-
-