Program counting space in text file k_pr4

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Category: Homework in Pascal

Author: Pheo
web: pascalsource.ic.cz

Program: Count_space.pas
File exe: Count_space.exe
File ubuntu: Count_space
need: K_pr4.txt

Program counting space in text file k_pr4.txt.
{ COUNT_SPACE.PAS                                Copyright (c) Pheo }
{ Program spočíta medzery v texte uloženom v textovom súbore.       }
{                                                                   }
{ Datum:05.04.2005                             http://www.trsek.com }
 
program count_space;
var t:text;
    c:char;
    pocet:integer;
begin
  assign(t,'k_pr4.txt'); reset(t);
  pocet:=0; 
  while not eof(t) do 
    begin
      read(t,c);
      if c=' ' then pocet:=pocet+1
    end;
  writeln('Pocet medzier v subore ',pocet);
  readln;
end.