Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- liste = record
- next: ^liste;
- inf: integer;
- end;
- list = record
- list1, list2, list3, list4: ^liste;
- end;
- var
- listw: list;
- i, inf, n, n1, n2: integer;
- x: boolean;
- s: string;
- procedure vvod(var listw: list);
- var
- i:integer;
- begin
- begin
- for i:=1 to 10 do
- begin
- New(listw.list2^.next);
- listw.list2^.inf := i+i;
- write(listw.list2^.inf,' ');
- listw.list2 := listw.list2^.next;
- end;
- writeln();
- end;
- end;
- procedure prov(listw: list; g: integer);
- var
- h: integer; b: boolean; i: integer;
- begin
- if listw.list1 <> nil then
- begin
- if listw.list1^.inf < listw.list1^.next^.inf then
- b := true
- else
- begin
- b := false;
- writeln('Список не упорядочен');
- end;
- for i := 1 to g do
- listw.list1 := listw.list1^.next;
- if b = true then
- prov(listw, g + 1);
- end;
- if (listw.list1 = nil) and (b = true) then
- writeln('Список упорядочен');
- end;
- begin
- New(listw.list1);
- listw.list2 := listw.list1;
- vvod(listw);
- prov(listw, 1);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement