home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PASSRC.ZIP / SMALLREC.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-04  |  2KB  |  61 lines

  1.                                 (* Chapter 9 - Program 1 *)
  2. program A_Small_Record;
  3.  
  4. type Description = record
  5.        Year    : integer;
  6.        Model   : string[20];
  7.        Engine  : string[8];
  8.        end;
  9.  
  10. var  Truck : Description;
  11.      Cars  : array[1..10] of Description;
  12.      Index : integer;
  13.  
  14. begin  (* main program *)
  15.  
  16.    Truck.Year := 1988;
  17.    Truck.Model := 'Pickup';
  18.    Truck.Engine := 'Diesel';
  19.  
  20.    for Index := 1 to 10 do begin
  21.       Cars[Index].Year := 1930 + Index;
  22.       Cars[Index].Model := 'Duesenburg';
  23.       Cars[Index].Engine := 'V8';
  24.    end;
  25.  
  26.    Cars[2].Model := 'Stanley Steamer';
  27.    Cars[2].Engine := 'Coal';
  28.    Cars[7].Engine := 'V12';
  29.    Cars[9].Model := 'Ford';
  30.    Cars[9].Engine := 'rusted';
  31.  
  32.    Write('My ',Truck.Year:4,' ');
  33.    Write(Truck.Model,' has a ');
  34.    Writeln(Truck.Engine,' engine.');
  35.  
  36.    for Index := 1 to 10 do begin
  37.       Write('My ',Cars[Index].Year:4,' ');
  38.       Write(Cars[Index].Model,' has a ');
  39.       Writeln(Cars[Index].Engine,' engine.');
  40.    end;
  41. end.  (* of main program *)
  42.  
  43.  
  44.  
  45.  
  46. { Result of execution
  47.  
  48. My 1988 Pickup has a Diesel engine.
  49. My 1931 Duesenburg has a V8 engine.
  50. My 1932 Stanley Steamer has a Coal engine.
  51. My 1933 Duesenburg has a V8 engine.
  52. My 1934 Duesenburg has a V8 engine.
  53. My 1935 Duesenburg has a V8 engine.
  54. My 1936 Duesenburg has a V8 engine.
  55. My 1937 Duesenburg has a V12 engine.
  56. My 1938 Duesenburg has a V8 engine.
  57. My 1939 Ford has a rusted engine.
  58. My 1940 Duesenburg has a V8 engine.
  59.  
  60. }
  61.