uses crt;
type element = record
data:integer;
next:pointer;
end;
var
curr,head:^element;
t:integer;
f:text;
s:string;
begin
head:=nil;
clrscr;
Write('Введите имя исходного файла: ');
readln(s);
assign(f,s);
reset(f);
while not(eof(f)) do
begin
new(curr);
read(f,t);
curr^.data:=t;
curr^.next:=head;
head:=curr;
end;
close(f);
curr:=head;
Write('Введите имя результирующего файла: ');
readln(s);
assign(f,s);
rewrite(f);
while curr<>nil do
begin
if abs(curr^.data)>1 then curr^.data:=-curr^.data;
writeln(curr^.data);
write(f,curr^.data,' ');
curr:=curr^.next;
end;
close(f);
{отчистка памяти}
if head<>nil then
begin
curr:=head;
curr:=curr^.next;
while curr<>nil do
begin
head^.next:=curr^.next;
dispose(curr);
curr:=head^.next;
end;
dispose(head);
end;
readln;
end.