Сергей
Ravil
type tSpis = ^rSpis; rSpis = record N : Integer; Next : tSpis; end;
procedure Include(var F, L : tSpis; N : Integer);
var C : tSpis;
begin
New(C); C^.N := N; C^.Next := nil; if F = nil then F := C else L^.Next := C; L := C;
end;
procedure OutSpis(C : tSpis);
begin
while C nil do begin Write(#32, C^.N); C := C^.Next; end; WriteLn;
end;
var pF, pL, oFf, oL : tSpis; N : Integer;
begin
pF := nil; oFf := nil;
repeat
Write('Enter N = '); ReadLn(N);
if N < 0 then Include(oFf, oL, N)
else if N > 0 then Include(pF, pL, N);
until N = 0;
WriteLn('- : '); OutSpis(oFf);
WriteLn('+ : '); OutSpis(pF);
end.
Похожие вопросы