*/
Looking for work? Check out our jobs area.
*/

View \READDISP.PAS

This is the second disk of the PASCAL TUTOR system. It has the

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


(* Chapter 11 - Program 2 *)
program Read_And_Display;

var Chicken    : text;
    Name_Of_File_To_Input : string[12];
    Line_Count : integer;
    Big_String : string[80];

begin  (* main program *)
   Write('Enter input file name ');
   Readln(Name_Of_File_To_Input);
   Assign(Chicken,Name_Of_File_To_Input);
   Reset(Chicken);

   Writeln;
   Writeln('Program listing with character count per');
   Writeln('line and total line count');
   Writeln;

   Line_Count := 0;
   while not Eof(Chicken) do begin
      Readln(Chicken,Big_String);
      Writeln(Length(Big_String):5,'  ',Big_String);
      Line_Count := Line_Count + 1;
   end;
   Close(Chicken);
   Writeln;
   Writeln('The line count is ',Line_Count:3);
end(* of program *)

corner
© 1996-2008 CommunityHeaven LLC. 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.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.