home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PASANS.ZIP / CH11_2.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-04  |  728b  |  35 lines

  1.                            (* Chapter 11 - Programming exercise 2 *)
  2. program Read_And_Count;
  3.  
  4. var Turkey     : TEXT;
  5.     Big_String : string[80];
  6.     Line_Size  : integer;
  7.     Line_Count : integer;
  8.  
  9. begin  (* main program *)
  10.    Assign(Turkey,'CH11_2.PAS');
  11.  
  12.    Reset(Turkey);
  13.    Line_Count := 0;
  14.    while not Eof(Turkey) do begin
  15.       Readln(Turkey,Big_String);
  16.       Write(Length(Big_String):6);
  17.       Writeln('  ',Big_String);
  18.       Line_Count := Line_Count + 1;
  19.    end;  (* of while loop *)
  20.  
  21.    Writeln;
  22.    Writeln('The total line count is',Line_Count:4);
  23.  
  24.    Close(Turkey);
  25. end.  (* of program *)
  26.  
  27.  
  28.  
  29.  
  30. { Result of execution
  31.  
  32. (This file is displayed on the monitor with character counts)
  33.  
  34. }
  35.