home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog2 / record1.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  1.0 KB  |  51 lines

  1.                                        -- Chapter 12 - Program 1
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure Record1 is
  6.  
  7.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  8.    use Int_IO;
  9.  
  10.    type DATE is
  11.       record
  12.          Month : INTEGER range 1..12;
  13.          Day   : INTEGER range 1..31;
  14.          Year  : INTEGER range 1776..2010;
  15.       end record;
  16.  
  17.    Independence_Day : DATE;
  18.    Birth_Day        : DATE;
  19.    Today,Pay_Day    : DATE := (5,25,1982);
  20.  
  21. begin
  22.    Independence_Day.Month := 7;
  23.    Independence_Day.Day := 4;
  24.    Independence_Day.Year := 1776;
  25.  
  26.    Birth_Day := Independence_Day;
  27.  
  28.    Pay_Day.Day := 30;
  29.  
  30.    Put("Independence day was on ");
  31.    Put(Independence_Day.Month,2);
  32.    Put("/");
  33.    Put(Independence_Day.Day,2);
  34.    Put("/");
  35.    Put(Independence_Day.Year,4);
  36.    New_Line;
  37.  
  38.    Birth_Day := (Day => 19, Month => 2, Year => 1937);
  39.    Today := (7,14,1952);
  40.    Pay_Day := (7, Year => 1954, Day => 17);
  41.  
  42. end Record1;
  43.  
  44.  
  45.  
  46.  
  47. -- Result of execution
  48.  
  49. -- Independence day was on  7/ 4/1776
  50.  
  51.