Цитата(Hazar @ 27.12.2007, 15:19 ) | Напишите программу |
Это приказ?!
Код | uses CRT; var S, Sl : String; Count, CountP, j, Space : Integer;
const Str : array [0..6] of Char = ('e','y','u','i','o','a','j'); Pr : array [0..6] of Char = (',','.',':',';','!','?','-');
function Glas(C : Char) : Boolean; var i : Integer; begin Glas := False; for i := 0 to 7 do if C = Str[i] then Glas := True; end;
function Prep(C : Char) : Boolean; var i : Integer; begin Prep := False; for i := 0 to 7 do if C = Pr[i] then Prep := True; end;
begin ClrScr; Count := 0; CountP := 0; Space := 0; Writeln('Vvedite stroky'); ReadLn(S); WriteLn('Vvedite clovo, kotoroe nado nauti'); ReadLn(Sl); WriteLn('Slovo ',Sl,' nachinaet`sja s ',Pos(Sl,S),' pozicui'); for j := 1 to Length(S) do if Glas(S[j]) then Count := Count + 1 else if Prep(S[j]) then CountP := CountP + 1 else if S[j] = ' ' then Space := Space + 1; WriteLn('V stroke ',Count,' glasnux, ',Length(S) - Count - CountP - Space,' soglasnux, ', CountP,' znakov prepinania'); ReadLn; end.
|
|