Advertisement
melnikovmaxim

KLENINA_input_and_output_list

Dec 16th, 2019
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.50 KB | None | 0 0
  1. //link https://yadi.sk/d/4BGcJFnavyeZ3Q
  2. type
  3.    liste = record
  4.       next: ^liste;
  5.       inf: integer;
  6.    end;
  7.    
  8.    list = record
  9.       list1, list2, list3, list4: ^liste;
  10.    end;
  11.  
  12. var
  13.    listw:list;
  14.    i, inf, n, n1, n2: integer;
  15.    x:boolean;
  16.    s:string;
  17.    
  18.  
  19.    
  20.    procedure vvod(var listw: list);
  21.    var y:integer;
  22.       begin
  23.             begin
  24.                   writeln('Введите элемент который хотите добавить');
  25.                   readln(y);
  26.                   New(listw.list2^.next);
  27.                   listw.list2^.inf := y;
  28.                   listw.list2 := listw.list2^.next;
  29.             end;
  30.       end;
  31.    
  32.    procedure vivod(listw: list);
  33.    begin
  34.    writeln(listw.list1^.inf);
  35.       writeln('Вывод списка элементов:');
  36.       while listw.list1 <> nil do
  37.          begin
  38.             if listw.list1^.next<>nil then
  39.             Writeln(listw.list1^.inf);
  40.             listw.list1 := listw.list1^.next;
  41.          end;
  42.       listw.list1 := listw.list3;
  43.       writeln();
  44.    end;
  45.    
  46. begin
  47.    New(listw.list1);
  48.    listw.list2 := listw.list1;
  49.    while x=false do
  50.       begin
  51.          writeln('1 - добавить элемент (только числа), 2 - вывести список ');
  52.          readln(i);
  53.          if i=1 then
  54.             vvod(listw)
  55.          else
  56.             if i=2 then
  57.                vivod(listw)
  58.          else
  59.          writeln('Введите корректное число');
  60.       end;
  61. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement