- program Zaliczenie;
- Uses StrUtils;
- function samogloski(tekst:string):integer;
- var i, liczba : integer;
- begin
- liczba:=0;
- for i:=1 to length(tekst) do
- begin
- if (tekst[i]='a') or (tekst[i]='A') or (tekst[i]='e') or (tekst[i]='E') or
- (tekst[i]='y') or (tekst[i]='Y') or (tekst[i]='i') or (tekst[i]='I') or
- (tekst[i]='o') or (tekst[i]='O') or (tekst[i]='u') or (tekst[i]='U') then
- liczba := liczba + 1;
- end;
- result := liczba;
- end;
- function duze_znaki(tekst:string):integer;
- var i, ilosc:integer;
- begin
- ilosc := 0;
- for i:=1 to length(tekst) do
- begin
- if (ord(tekst[i])>=65) and (ord(tekst[i])<=90) then
- ilosc:=ilosc + 1;
- end;
- result := ilosc;
- end;
- function pierwsza_samogloska(tekst:string):integer;
- var i, ilosc: integer;
- begin
- ilosc:=0;
- if (tekst[1]='a') or (tekst[1]='A') or (tekst[1]='e') or (tekst[1]='E') or
- (tekst[1]='y') or (tekst[1]='Y') or (tekst[1]='i') or (tekst[1]='I') or
- (tekst[1]='o') or (tekst[1]='O') or (tekst[1]='u') or (tekst[1]='U') then
- ilosc:=ilosc + 1;
- for i:=1 to length(tekst) do begin
- if (tekst[i]=',') or (tekst[i]='.') then begin
- if (tekst[i+2]='a') or (tekst[i+2]='A') or
- (tekst[i+2]='e') or (tekst[i+2]='E') or (tekst[i+2]='y') or (tekst[i+2]='Y') or
- (tekst[i+2]='i') or (tekst[i+2]='I') or(tekst[i+2]='o') or (tekst[i+2]='O') or
- (tekst[i+2]='u') or (tekst[i+2]='U') then ilosc:=ilosc+1;
- end;
- end;
- result := ilosc;
- end;
- function liczby(tekst:string):integer;
- var i, ilosc, flaga:integer;
- begin
- ilosc:=0;
- flaga:=1;
- for i:=1 to length(tekst) do
- begin
- if ((tekst[i]>='0') and (tekst[i]<='9')) or
- ((tekst[i-1]>='0') and (tekst[i-1]<='9') and (tekst[i]=',')) or
- ((tekst[i-1]>='0') and (tekst[i-1]<='9') and (tekst[i]='.')) then
- begin
- if (flaga=1) then
- begin
- ilosc:=ilosc + 1;
- flaga:=0;
- end;
- end
- else flaga:=1;
- end;
- result:=ilosc;
- end;
- function zlicz_spojniki(tekst:string):integer;
- const spojniki:array[1..3] of string = (' a ',' lub ', ' i ');
- var ilosc, pozycja, pozycja_temp, i, licznik:integer;
- begin
- licznik:=1;
- ilosc:=0;
- pozycja:=1;
- pozycja_temp:=1;
- for i:=1 to 3 do
- begin
- while(licznik<=length(tekst)) do begin
- pozycja:=PosEx(spojniki[i], tekst, licznik);
- if(pozycja<>pozycja_temp) then begin
- ilosc:=ilosc+1;
- pozycja_temp:=pozycja;
- end;
- licznik:=licznik+length(spojniki[i])-1;
- end;
- pozycja:=1;
- pozycja_temp:=-1;
- licznik:=1;
- end;
- result:=ilosc;
- end;
- var lancuch:string;
- f:text;
- licznik, d:integer;
- begin
- licznik:=1;
- assignfile(f, 'we.txt');
- reset(f);
- while not EoF(f) do
- begin
- writeln('tekst nr.', licznik);
- readln(f, lancuch);
- writeln('ilosc samoglosek ', samogloski(lancuch));
- writeln('ilosc zdan zaczynajacych sie od samogloski ', pierwsza_samogloska(lancuch));
- writeln('ilosc duzych znakow: ', duze_znaki(lancuch));
- writeln('ilosc liczb: ', liczby(lancuch));
- writeln('ilosc spojnikow: ', zlicz_spojniki(lancuch));
- writeln('-------------------------------------------------');
- licznik:=licznik+1;
- end;
- closefile(f);
- readln;
- end.