const M: array[1..8] of real = (0.1, 5.6, 0.8, 2.4, 7.3, 6.8, 0.5, 2.3);
var x,y : file of real;
n: real; i: byte;
begin
assign(x,'x.dat');
assign(y,'y.dat');
rewrite(x);
for i:=1 to 8 do write(x, M[i]);
close(x);
reset(x);
rewrite(y);
i := 1;
while not EOF(x) do begin
read(x, n);
if not odd(i) then
write(y, n);
i := i + 1;
end;
close(y);
reset(y);
while not EOF(y) do begin
read(y, n);
write(n:5:1);
writeln;
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
const M: array[1..8] of real = (0.1, 5.6, 0.8, 2.4, 7.3, 6.8, 0.5, 2.3);
var x,y : file of real;
n: real; i: byte;
begin
assign(x,'x.dat');
assign(y,'y.dat');
rewrite(x);
for i:=1 to 8 do write(x, M[i]);
close(x);
reset(x);
rewrite(y);
i := 1;
while not EOF(x) do begin
read(x, n);
if not odd(i) then
write(y, n);
i := i + 1;
end;
close(x);
close(y);
reset(y);
while not EOF(y) do begin
read(y, n);
write(n:5:1);
end;
writeln;
close(y);
end.