logo
ГОСЫ / ГОСБилеты

Билет 10.

uses

SysUtils,

Windows;

//Program Zadanie_10;

//Uses Crt;

Type

TPtr = ^TElem;

TElem = record

Inf :Integer;

Link:TPtr;

end;

Var

Z,Value:Integer;

Top_O, End_O:TPtr;

Procedure Add_Z(Val:Integer);

Var P:TPtr;

Begin

New(P);

P^.Inf:=Val;

P^.Link:=nil;

if Top_O = nil Then

Top_O:=P

else

End_O^.Link:=P;

End_O:=P;

End;

Procedure Del_Z(var Val:Integer);

Var P:TPtr;

Begin

Val:=Top_O^.Inf;

P:=Top_O;

Top_O:=P^.Link;

if Top_O=nil Then

End_O:=nil;

Dispose(P);

End;

Begin

//ClrScr;

Writeln('Create OCHERED...');

Top_O:=nil;

End_O:=nil;

Writeln('Ukagite deistvie:');

Writeln(' 1. Zapis v Ochered');

Writeln(' 2. Izvlechenie iz Ochered');

Writeln(' 3. Ochistka Ochered and print');

Writeln(' 4. EXIT');

Repeat

Readln(Z);

If Z=1 Then Begin

Writeln('Vvedite VALUE == ');

Readln(Value);

Add_Z(Value);

End;

If Z = 2 Then

Begin

Del_Z(Value);

Writeln('Izvlechennoe VALUE == ',Value);

End;

If Z = 3 Then Begin

While Top_O <> nil do

Begin

Del_Z(Value);

Writeln('Izvlechennoe VALUE == ',Value);

End;

End;

Until (Z=4);

End.

//begin

{ TODO -oUser -cConsole Main : Insert code here }

//end.