Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //link https://yadi.sk/d/37EEnaZxM88Ovg
- type
- uk = ^list1;
- list1 = record
- next: ^list1;
- inf: integer;
- end;
- uk2 = ^list2;
- list2 = record
- next: ^list2;
- inf: integer;
- end;
- uk3 = ^list3;
- list3 = record
- next: ^list3;
- inf: integer;
- end;
- var
- head1, q1: uk;
- head2, q2: uk2;
- head3, q3: uk3;
- i, j, j1: integer;
- m: array[1..20] of integer;
- begin
- new(head1);
- new(head2);
- new(head3);
- new(q1);
- new(q2);
- new(q3);
- head1 := q1;
- head2 := q2;
- head3 := q3;
- writeln('Первый список');
- for i := 1 to 5 do
- begin
- new(q1^.next);
- if i=1 then
- begin
- writeln('Введите 5 элементов 1-го списка');
- writeln();
- end;
- writeln('Введите ',i,' элемент списка');
- readln(q1^.inf);
- if i < 5 then
- q1 := q1^.next;
- end;
- writeln();
- writeln('Второй список');
- for i := 1 to 5 do
- begin
- new(q2^.next);
- if i=1 then
- begin
- writeln('Введите 5 элементов 1-го списка');
- writeln();
- end;
- writeln('Введите ',i,' элемент списка');
- readln(q2^.inf);
- if i < 5 then
- q2 := q2^.next;
- end;
- writeln();
- q1 := head1;
- q2 := head2;
- for i := 1 to 5 do
- begin
- m[i] := q1^.inf;
- q1 := q1^.next;
- m[i + 5] := q2^.inf;
- q2 := q2^.next;
- end;
- for i := 9 downto 1 do
- for j := 1 to i do
- if m[j] > m[j + 1] then begin
- j1 := m[j];
- m[j] := m[j + 1];
- m[j + 1] := j1;
- end;
- for i := 1 to 10 do
- begin
- new(q3^.next);
- q3^.inf := m[i];
- q3 := q3^.next;
- end;
- q3 := head3;
- writeln('Третий список');
- while head3^.next <> nil do
- begin
- write(head3^.inf,' ');
- head3 := head3^.next;
- end;
- q1 := head1;
- q2 := head2;
- while q1<>nil do
- begin
- head1:=head1^.next;
- dispose(q1);
- q1:=head1;
- end;
- while q2<>nil do
- begin
- head2:=head2^.next;
- dispose(q2);
- q2:=head2;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement