Приветствую Вас Гость | RSS

Delphi заготовки

Суббота, 11.05.2024, 23:12
Главная » 2012 » Апрель » 23 » The specified text, the end of a period
20:19
The specified text, the end of a period
The specified text, the end of a period. Give all the vowels in alphabetical order, included in the text, and number of repetitions of each letter.
Delphi/Pascal
"Заданный текст, конец которого точка. Вывести по алфавиту все гласные, входящие в этот текст, и количество повторений каждой буквы."
Просмотров: 889 | Добавил: NetSoftWare | Рейтинг: 0.0/0
Всего комментариев: 1
1 NetSoftWare  
0
const s='В лесу родилась ёлочка,в лесу она росла.';
sen=['а','е','ё','и','о','у','ы','э','ю','я'];

type tset=set of char;
tarray=array['а'..'ё'] of integer;

procedure readset(var aset:tset);
var i:byte;
begin
for i:=1 to length(s) do
aset:=aset+[s[i]];
end;

procedure count(var aset:tset;var amas:tarray);
var i:byte;
begin
for i:=1 to length(s) do
if (s[i] in aset) and (s[i] in ['а'..'ё']) then
inc(amas[s[i]]);
end;

procedure writecount(var aset:tset;var amas:tarray);
var ch:char;
begin
for ch:='а' to 'ё' do
if (ch in aset) and (ch in ['а'..'ё']) then begin
write(ch);
writeln(amas[ch]:4);
end;
end;

var sn:tset;
mas:tarray;
ch:char;
begin
sn:=[];
for ch:='а' to 'ё' do mas[ch]:=0;
readset(sn);
sn:=sn*sen;
count(sn,mas);
writecount(sn,mas);
readln
end.

Имя *:
Email *:
Код *: