Версия для печати темы

Нажмите сюда для просмотра этой темы в обычном формате

Форум «Всё о Паскале» _ Задачи _ Pchar

Автор: Гость 24.05.2006 3:24

Помогите!!!!
Необходимо переделать задачу под использование PChar, как зделать понятия не имею


program pr1;
const
max_word=200;
var word:array[0..max_word] of string;
count: array[0..max_word] of byte;
procedure add(s:string);
var
i:byte;
begin
if s='' then exit;
i:=0;
while word[i]<>''do
begin
if s=word[i] then
begin
inc(count[i]);
exit;
end;
i:=i+1;
end;
word[i]:=s;
count[i]:=1;
word[i+1]:='';
end;
procedure make(text:string);
var
temp:string;
i:byte;
begin
word[0]:='';
temp:='';
for i:=1 to length(text) do
begin
if text[i]=' ' then
begin
add(temp);
temp:='';
continue;
end;
temp:=temp+text[i];
end;
add(temp);
end;
function pod:byte;
var
n,i,max:byte;
begin
n:=0;
max:=0;
while word[n]<>'' do
begin
count[n]:=0;
for i:=1 to length(word[n]) do
if word[n][i] in ['a','e','i','o','u'] then
inc(count[n]);
if count[n]>max then max:=count[n];
n:=n+1;
end;
pod:=max;
end;
var
i,max:byte;
text:string;
begin
writeln('ввод текста');
readln(text);
make(text);
i:=0;
writeln(‘слова встречающиеся в тексте');
while word[i]<>'' do
begin
writeln(' ',word[i],'-',count[i]);
i:=i+1;
end;
readln;
max:=pod;
writeln('-------------------------------------------');
writeln('­ максимальное кол-во гласных ',max);
writeln('-------------------------------------------');
i:=0;
while word[i]<>'' do
begin
if count[i]=max then
writeln(word[i]);
i:=i+1;
end;
readln;
end.