Программа, которая считывает слова из одного текстового файла и записывает их в столбик в другой текстовый файл — Pascal(Паскаль)

Program forkloyn;
 
var f,g:text;
s:string;
 
procedure task(s:string; k:integer);
var i,p,nslov:integer;
    m:array[1..50] of string;
begin
for i:=1 to length(s) do
if (s[i]='.') or (s[i]='!') or (s[i]=',') or (s[i]='-') then delete(s,i,1);
i:=0;
repeat
p:=pos(' ',s);
inc(i);
if length(copy(s,1,p-1))>1 then m[i]:=copy(s,1,p-1);
delete(s,1,p);
until p=0;
inc(i);
if length(s)>1 then m[i]:=s;
nslov:=i;
{*****}
for i:=1 to nslov do
if length(m[i])>k then writeln(g,m[i]);
end;
 
begin
assign (f,'1.txt' ); reset (f);
assign (g,'2.txt' ); rewrite(g);
while not eof(f) do begin
readln(f,s);
task(s,2);
end;
 
close(f);
writeln;writeln('Slova uspeshno perepisany v fail "2.txt"');
close(g);
readln;
end.     

Leave a Comment

64 − = 58