uses crt;
const ABC = 'ABC.txt';
INV = 'INV.txt';
var f : text;
arr : array[1..30] of string;
st : string;
i, j, k : integer;
begin
clrscr;
i := 0;
assign(f, ABC);
reset(f);
while not eof(f) do
begin
inc(i);
readln(f, arr[i]);
end;
close(f);
writeln('File ',ABC,' is open, read and closed.');
for j := 0 to round(i div 2) do
begin
st := arr[j+1];
arr[j+1] := arr[i-j];
arr[i-j] := st;
end;
assign(f, INV);
rewrite(f);
for j := 1 to i do
writeln(f, arr[j]);
close(f);
writeln('File ',INV,' is modified.');
readkey;
end.
Вариант 2
uses crt;
const ABC = 'ABC.txt';
INV = 'INV.txt';
var f : text;
arr : array[1..30] of string;
st : string;
i, j, k : integer;
begin
clrscr;
i := 0;
assign(f, ABC);
reset(f);
while not eof(f) do
begin
inc(i);
readln(f, arr[i]);
end;
close(f);
writeln('File ',ABC,' is open, read and closed.');
assign(f, INV);
rewrite(f);
for j := i downto 1 do
writeln(f, arr[j]);
close(f);
writeln('File ',INV,' is modified.');
readkey;
end.