uses Crt; type list = ^item; item = record data:integer; next:list; end; var lastptr,newptr,first,current,last:list; procedure initList; var x:integer; begin last:=nil; readln(x); while x <> 0 do begin new(current); current^.data:=x; current^.next:=nil; if (last = nil) then first:=current else last^.next:=current; last:=current; readln(x); end; end; procedure newlist; begin current:=first; lastptr:=nil; while current <> nil do begin new(newptr); newptr^.data:=current^.data; newptr^.next:=lastptr; current:=current^.next; lastptr:=newptr; end; end; procedure print; begin current:=first; while current <> nil do begin write(current^.data, ' '); current:=current^.next; end; end; procedure connect; begin current:=last; current^.next:=newptr; end; Begin clrscr; first:=nil; initList; newList; connect; print; readkey; End.