                                        (* Chapter 11 - Program 1 *)
MODULE SmallRec;

FROM InOut   IMPORT WriteString, WriteCard, WriteLn;

TYPE Description = RECORD
       Year   : CARDINAL;
       Model  : ARRAY[0..20] OF CHAR;
       Engine : ARRAY[0..8] OF CHAR
     END;

VAR  Truck : Description;
     Cars  : ARRAY[1..10] OF Description;
     Index : CARDINAL;

BEGIN   (* Main Program *)

   Truck.Year := 1981;
   Truck.Model := " Pickup";
   Truck.Engine := "Diesel";

   FOR Index := 1 TO 10 DO
      Cars[Index].Year := 1930 + Index;
      Cars[Index].Model := " Duesenberg";
      Cars[Index].Engine := "V8";
   END;

   Cars[2].Model := " Stanley Steamer";
   Cars[2].Engine := "Coal";
   Cars[7].Engine := "V12";
   Cars[9].Model := " Ford";
   Cars[9].Engine := "rusted";
   Cars[9].Year := 1981;

   WriteString('My');
   WriteCard(Truck.Year,5);
   WriteString(Truck.Model);
   WriteString(" has a ");
   WriteString(Truck.Engine);
   WriteString(' engine.');
   WriteLn;

   FOR Index := 1 TO 10 DO
      WriteString('My');
      WriteCard(Cars[Index].Year,5);
      WriteString(Cars[Index].Model);
      WriteString(" has a ");
      WriteString(Cars[Index].Engine);
      WriteString(' engine.');
      WriteLn;
   END;
END SmallRec.




(* Result of execution

My 1981 Pickup has a Diesel engine.
My 1931 Duesenberg has a V8 engine.
My 1932 Stanley Steamer has a Coal engine.
My 1933 Duesenberg has a V8 engine.
My 1934 Duesenberg has a V8 engine.
My 1935 Duesenberg has a V8 engine.
My 1936 Duesenberg has a V8 engine.
My 1937 Duesenberg has a V12 engine.
My 1938 Duesenberg has a V8 engine.
My 1981 Ford has a rusted engine.
My 1940 Duesenberg has a V8 engine.

*)

