Determine count char in sentence
Delphi & Pascal (česká wiki)
Category: Homework in Pascal
Author: Juraj Pupák
Program: Pocetpis.pas
File exe: Pocetpis.exe
Author: Juraj Pupák
Program: Pocetpis.pas
File exe: Pocetpis.exe
Determine count char in sentence.
{ POCETPIS.PAS } { Zisti pocet pismen vo vete. } { } { Author: Juraj Pupak } { Date : 27.10.2006 http://www.trsek.com } program PocetPismen; uses crt; Function Overenie_Pismena(veta : string;index : integer) : boolean; var dlzka_vety,i : integer; Is_Char : boolean; begin dlzka_vety := length(veta); Is_Char := False; For i := 1 To index - 1 Do begin IF veta[i] = veta[index] THEN Is_Char := True; end; Overenie_Pismena := Is_Char; end; var veta : string; pismeno : char; index,i : integer; pocet_pismen,dlzka_vety : integer; begin clrscr; writeln('Zadaj vetu velkymi pismenami'); readln(veta); clrscr; dlzka_vety := length(veta); For index := 1 To dlzka_vety Do begin IF (veta[index] <> ' ') and (Overenie_Pismena(veta,index) = False) THEN begin For i := 1 To dlzka_vety Do begin IF veta[index] = veta[i] THEN begin pocet_pismen := pocet_pismen + 1; end; end; writeln(veta[index],'..',pocet_pismen); pocet_pismen := 0; end; end; readln; end.