home *** CD-ROM | disk | FTP | other *** search
- -- Chapter 13 - Programming exercise 1
- with Text_IO;
- use Text_IO;
-
- procedure Ch13_1 is
-
- package Real_IO is new Text_IO.Float_IO(FLOAT);
- use Real_IO;
-
- type BOX_TYPE is
- record
- Length : FLOAT;
- Width : FLOAT;
- Height : FLOAT;
- end record;
-
- type POINT_TO_BOX is access BOX_TYPE;
-
- Small, Medium, Large : POINT_TO_BOX;
-
- begin
-
- Small := new BOX_TYPE;
- Medium := new BOX_TYPE;
- Large := new BOX_TYPE;
-
- Small.Length := 3.5;
- Small.Width := 2.4;
- Small.Height := 1.9;
- Medium.Length := 7.4;
- Medium.Width := 6.4;
- Medium.Height := 9.3;
- Large.Length := 13.8;
- Large.Width := 21.5;
- Large.Height := 15.1;
-
- Put(Small.Length,8,3,0);
- Put(Small.Width,8,3,0);
- Put(Small.Height,8,3,0);
- Put(Small.Length * Small.Width * Small.Height,8,3,0);
- New_Line;
-
- Put(Medium.Length,8,3,0);
- Put(Medium.Width,8,3,0);
- Put(Medium.Height,8,3,0);
- Put(Medium.Length * Medium.Width * Medium.Height,8,3,0);
- New_Line;
-
- Put(Large.Length,8,3,0);
- Put(Large.Width,8,3,0);
- Put(Large.Height,8,3,0);
- Put(Large.Length * Large.Width * Large.Height,8,3,0);
- New_Line;
-
- end Ch13_1;
-
-
-
-
- -- Result of execution
-
- -- 3.500 2.400 1.900 15.960
- -- 7.400 6.400 9.300 440.448
- -- 13.800 21.500 15.100 4480.170
-