home *** CD-ROM | disk | FTP | other *** search
- -- Chapter 21 - Programming exercise 3
- package Stuff is
-
- type MONTH_NAMES is (JAN, FEB, MAR, APR, MAY, JUN,
- JUL, AUG, SEP, OCT, NOV, DEC);
- type DATE is
- record
- Month : MONTH_NAMES;
- Day : INTEGER range 1..31;
- Year : INTEGER range 1800..2100;
- end record;
-
- Pi : constant := 3.14159;
- Two_Pi : constant := 2 * Pi;
-
- end Stuff;
-
-
-
- with Text_IO, Stuff;
- use Text_IO, Stuff;
-
- procedure CH21_3 is
-
- package Flt_IO is new Text_IO.Float_IO(FLOAT);
- use Flt_IO;
- package Int_IO is new Text_IO.Integer_IO(INTEGER);
- use Int_IO;
- package Enum_IO is new Text_IO.Enumeration_IO(MONTH_NAMES);
- use Enum_IO;
-
- Birth_Day : DATE := (OCT, 18, 1938);
-
- begin
- Put("My birthday is ");
- Put(Birth_Day.Month);
- Put(Birth_Day.Day,3);
- Put(",");
- Put(Birth_Day.Year,5);
- New_Line(2);
-
- Put("The value of Pi is");
- Put(Pi,3,6,0);
- New_Line;
- end CH21_3;
-
-
-
-
- -- Result of execution
-
- -- My birthday is OCT 18, 1938
- --
- -- The value of Pi is 3.141590
-
-
-