var file of integer integer begin Assign dat Rewrite randomize begin -

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var
f,h:file of integer;
i,a:integer;
begin
Assign(f,'f.dat');
Rewrite(f);
randomize;
begin
a:=-5+random(11);
write(a,' ');
end;
Assign(h,'h.dat');
rewrite(h);
Seek(f, 0);
while (not Eof(f)) do
begin
read(f,a);
if (a>=0) then
write(h,a);
end;
seek (f,0);
while (not eof(f)) do
begin
read(f,a);
if (a<0) then
write(h,a)
end;
Seek(h,0);
Writeln;
while (not Eof(h)) do
begin
write(h,a);
write(a, ' ');
end;
Close(f);
Close(h);
readln;
end.