Stuck? Need help? Ask questions on our forums.

View \BININ.PAS

Getting Started with the Pascal tutorial, source

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


(* Chapter 11 - Program 7 *)
program Binary_Input;

type Input_Record = record
       Number : integer;
       Amount : real;
       Name   : string[30];
     end;

var Input_File : file of Input_Record;
    Bird_Food  : array[1..20] of Input_Record;
    Index      : byte;

begin  (* main program *)
   Assign(Input_File,'KIBBLES.BIT');
   Reset(Input_File);

   for Index := 1 to 20 do
      if not Eof(Input_File) then
         Read(Input_File,Bird_Food[Index]);
   Close(Input_File);

   Writeln(Bird_Food[6].Number:6,Bird_Food[20].Amount:13:5,
           '  ',Bird_Food[1].Name);
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.