UNIX Free Pascal


         

, ,


while (pos(' ',s)>0) do

begin

tmp:=' '+copy(s,1,pos(' ',s)-1)+tmp;

delete(s,1,pos(' ',s));

end;

tmp:=s+tmp;

revstr:=tmp;

end;

begin

if paramcount<2 then

begin

writeln('Error: wrong arguments');

writeln('format: 10 <fileinp> <fileout>');

Halt(1);

end;

Assign(F1,paramstr(1));

Reset(F1);

Assign(F2,paramstr(2));

Rewrite(F2);

while not(eof(F1)) do

begin

readln(F1,tmpstr);

writeln(F2,revstr(tmpstr));

end;

close(F2);

close(F1);

end.

13.18. , , , . , .

program check_gram;

var

F1,F2:text;

Temp:string;

Dot:boolean;

i:byte;

begin

Dot:=true;

if paramcount<>2 then halt(1);

assign(F1,paramstr(1));

reset(F1);

assign(F2,paramstr(2));

rewrite(F2);

while not(eof(F1)) do

begin

readln(F1,Temp);

for i:=1 to ord(Temp[0]) do

begin

if (Temp[i] in ['A'..'Z','a'..'z'])and Dot then

begin

Dot:=false;

if Temp[i] in ['a'..'z'] then Temp[i]:=chr(ord(Temp[i])-ord('a')+ord('A'))

end

else if (Temp[i] in ['.','!','?']) then Dot:=true

end;

writeln(F2,Temp);

end;

close(F2);

close(F1);

end.

13.19. , , . .

program sortedlist;

type

TRec = record

wrd:string[40];

num:word;

end;

var

List:array [1..1400] of TRec;

F:text;

stroka:string;

nump:byte;

i,j:word;

max:word;

Temp:TRec;

procedure checkadd(sm:string);

var

x:word;

T:boolean;

begin

T:=true;