Консультация № 169309
11.06.2009, 21:00
0.00 руб.
0 0 0
Здравствуйте! Помогите дописать программу. Она должна оставить в каждом слове только первые вхождения каждой буквы. Результат надо вывести в файл. Вот код, не знаю, как вывести массив строк:

Код:
uses crt;
type Mas=array[1..50] of string;
var
i, j, k, n : Integer;
s, w, x, NameFile: string;
bkv: set of char;
FileIn:text;
a:mas;
begin
write('Enter input file ' );
readln(NameFile);
assign(FileIn,NameFile);
reset(FileIn);
if IOResult<>0 then
begin
writeln('Error, file not found');
readln;
halt;
end;
n:=0;
while not Eof(FileIn) do
begin
inc(n);
readln(FileIn,a[n]);
end;
close(FileIn);

bkv:=['A'..'Z','a'..'z'];
clrscr;
for i:=1 to n do
s:=a[i];
begin
i:=1;
while i<=length(s) do
begin
w:= ' ' ;
while (i<=length(s)) and (s[i] in bkv) do
begin
w:=w+s[i] ;
i:=i+1
end;
j:=1;
while j<=length(w)do
begin
for k:=length(w) downto j+1 do
if w[k]=w[j] then delete(w,k,1);
inc(j);
end;
x:=x+w;
i:=i+1 ;
end;
end;
end.

Обсуждение

Форма ответа