home *** CD-ROM | disk | FTP | other *** search
- (* Chapter 9 - Program 1 *)
- program A_Small_Record;
-
- type Description = record
- Year : integer;
- Model : string[20];
- Engine : string[8];
- end;
-
- var Truck : Description;
- Cars : array[1..10] of Description;
- Index : integer;
-
- begin (* main program *)
-
- Truck.Year := 1988;
- Truck.Model := 'Pickup';
- Truck.Engine := 'Diesel';
-
- for Index := 1 to 10 do begin
- Cars[Index].Year := 1930 + Index;
- Cars[Index].Model := 'Duesenburg';
- 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';
-
- Write('My ',Truck.Year:4,' ');
- Write(Truck.Model,' has a ');
- Writeln(Truck.Engine,' engine.');
-
- for Index := 1 to 10 do begin
- Write('My ',Cars[Index].Year:4,' ');
- Write(Cars[Index].Model,' has a ');
- Writeln(Cars[Index].Engine,' engine.');
- end;
- end. (* of main program *)
-
-
-
-
- { Result of execution
-
- My 1988 Pickup has a Diesel engine.
- My 1931 Duesenburg has a V8 engine.
- My 1932 Stanley Steamer has a Coal engine.
- My 1933 Duesenburg has a V8 engine.
- My 1934 Duesenburg has a V8 engine.
- My 1935 Duesenburg has a V8 engine.
- My 1936 Duesenburg has a V8 engine.
- My 1937 Duesenburg has a V12 engine.
- My 1938 Duesenburg has a V8 engine.
- My 1939 Ford has a rusted engine.
- My 1940 Duesenburg has a V8 engine.
-
- }