UNIX Free Pascal




. - 6


end;

Writeln(sin);

Writeln(f2,sin);

end;

Close(f1);

Close(f2);

end.

 

13.11. , .

uses strings;

type

achar=array [0..255] of char;

mas=array [1..1] of achar;

var s:achar;

t:text;

a:^mas;

n,i,j,k:byte;

begin

s:='SRT4.txt';

assign(t,s);

reset(t);

k:=0;

while not eof(t) do

begin

readln(t,s);

inc(k)

end;

getmem(a,k*256);

close(t);

reset(t);

for i:=1 to k do

readln(t,a^[i]);

close(t);

for i:=1 to k-1 do

begin

for j:=i+1 to k do

if stricomp(a^[j],a^[i])>0 then

begin

strcopy(s,a^[j]);

strcopy(a^[j],a^[i]);

strcopy(a^[i],s);

end;

end;

for i:=1 to k do

writeln(a^[i]);

freemem(a,k*256);

end.

 

13.12. . tsed s/old/new/ _, old. old new. .

var

s,myold,mynew,s1:string;

n,l:byte;

t:text;

begin

if paramcount<>2 then begin

writeln('tsed s/old/new/ _');

exit

end;

s:=paramstr(1);

delete(s,1,2);

n:=pos('/',s);

myold:=copy(s,1,n-1);

l:=length(myold);

delete(s,1,n);

n:=pos('/',s);

mynew:=copy(s,1,n-1);

s:=paramstr(2);

assign(t,s);

reset(t);

while not eof(t) do

begin

n:=0;

readln(t,s);

n:=pos(myold,s);

if n<>0 then

begin

s1:=copy(s,1,n-1)+mynew+copy(s,n+l,length(s));

writeln(s1);

end else writeln(s);

end;

close(t);

end.

13.13. cut.