Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //link https://yadi.sk/d/e8qvlRFIqqruxw
- type
- liste = record
- next: ^liste;
- inf: integer;
- end;
- list = record
- list1, list2, list3, list4: ^liste;
- end;
- var
- listw: list;
- i, n1, n2: integer;
- procedure vvod(var listw: list; inf: integer);
- begin
- begin
- New(listw.list2^.next);
- listw.list2^.inf := inf;
- listw.list2 := listw.list2^.next;
- end;
- end;
- procedure perev(listw: list; n3: integer);
- var
- n4: integer;
- begin
- if n3 = n1 then
- writeln('Перевернутый список:');
- begin
- begin
- for n4 := 1 to n3 do
- listw.list1 := listw.list1^.next;
- if listw.list1^.next <> nil then
- Writeln(listw.list1^.inf);
- listw.list1 := listw.list1^.next;
- listw.list1 := listw.list4;
- end;
- end;
- if n3 > 0 then
- perev(listw, n3 - 1);
- end;
- begin
- New(listw.list1);
- listw.list2 := listw.list1;
- New(listw.list3);
- listw.list3 := listw.list1;
- New(listw.list3);
- listw.list4 := listw.list1;
- writeln('Введите количество элементов списка');
- readln(n1);
- for n2 := 1 to n1 do
- begin
- writeln('Введите элемент (цифры)');
- readln(i);
- vvod(listw, i);
- end;
- perev(listw, n1);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement