Are you blogging on PH? Get your free blog.

View \SMALLREC.PAS

Getting Started with the Pascal tutorial, source

Submitted By: WEBMASTER
Rating: (Not rated) (Rate It)


(* Chapter 9 - Program 1 *)
program A_Small_Record;

type Description = record
       Year    : integer;
       Model   : string[20];
       Engine  : string[8];
       end;

var  Cars  : array[1..10] of Description;
     Index : integer;

begin  (* main program *)
   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';

   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 *)

corner
© 1996-2008. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin.
bootstrapLabs Logo A bootstrapLabs project.