Var
f1,f2,f3: text;
max,min,i,t,j: integer;
b: boolean;
arr: array [1..100] of integer;
begin
i:=0;
{$I-}
assign(f1,'C:\1.txt'); reset(f1);
assign(f2,'C:\2.txt'); reset(f2);
assign(f3,'C:\3.txt'); rewrite(f3);
while not eof(f1) do begin
readln(f1,arr[i]);
inc(i);
end;
while not eof(f2) do begin
readln(f2,arr[i]);
inc(i);
end;
repeat
b := True;
for j := 1 to i-1 do
if arr[j] > arr[j+1] then begin
t := arr[j];
arr[j] := arr[j+1];
arr[j+1] := t;
b := False
end
until b;
for j:=1 to i-1 do writeln(f3,arr[j]);
close(f3);
readln
var a,b,c:file of integer;
x,y,t:integer;
begin
assign(a,'a.int');
assign(b,'b.int');
assign(c,'c.int');
{ Vvod znacheniy v faylu a,b -
(esli ne nuzhno - mozhno udalit)}
writeln('Vvedite chisla iz fayla A, v konce - 0');
rewrite(a);
readln(x);
while x<>0 do
begin
write(a,x);
readln(x);
end;
close(a);
writeln('Vvedite chisla iz fayla B, v konce - 0');
rewrite(b);
readln(x);
while x<>0 do
begin
write(b,x);
readln(x);
end;
close(b);
{Formirovanie fayla C};
reset(a); reset(b); rewrite(c);
read(a,x); read(b,y);
if x<y then t:=x-1 else t:=y-1;
while not(eof(a)) and not(eof(b)) do
begin
while (x<=t) and not(eof(a)) do read(a,x);
while (y<=t) and not(eof(b)) do read(b,y);
if (x<y) and (x>t) then
begin
t:=x;
write(c,t);
end
else if (y>t) then
begin
t:=y;
write(c,t);
end;
end;
while not(eof(a)) do
begin
read(a,x);
if x>t then
begin
t:=x;
write(c,t);
end;
end;
close(a);
while not(eof(b)) do
begin
read(b,x);
if x>t then
begin
t:=x;
write(c,t);
end;
end;
close(b); close(c);
{Vivod sodergimogo fayla C na ekran
(esli ne nuzhno - mozhno udalit)}
writeln('Itogovyj fayl:');
reset(c);
while not(eof(c)) do
begin
read(c,x);
write(x:5);
end;
readln;
end.
reset(a); reset(b); rewrite(c);
read(a,x); read(b,y);
if x<y then t:=x-1 else t:=y-1;
while not(eof(a)) and not(eof(b)) do
begin
while (x<=t) and not(eof(a)) do read(a,x);
while (y<=t) and not(eof(b)) do read(b,y);
if (x<y) and (x>t) then
begin
t:=x;
write(c,t);
end
else if (y>t) then
begin
t:=y;
write(c,t);
end;
end;
while not(eof(a)) do
begin
read(a,x);
if x>t then
begin
t:=x;
write(c,t);
end;
end;
close(a);
while not(eof(b)) do
begin
read(b,x);
if x>t then
begin
t:=x;
write(c,t);
end;
end;
close(b); close(c);