Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Project1;
- {$APPTYPE CONSOLE}
- uses
- SysUtils;
- type lista=^tlista;
- tlista=record
- imie:string;
- nazwisko:string;
- data:integer;
- wsk:^tlista;
- end;
- procedure dodaj (var pocz:lista);
- var
- nowy:lista;
- begin
- new (nowy);
- writeln ('Podaj imie');
- readln (nowy^.imie);
- writeln ('Podaj nazwisko');
- readln (nowy^.nazwisko);
- writeln ('Podaj rok urodzenia');
- readln (nowy^.data);
- if pocz=nil then nowy^.wsk:=nil else nowy^.wsk:=pocz;
- pocz:=nowy;
- end;
- procedure wyswietl (pocz:lista);
- begin
- if pocz=nil then
- begin
- writeln ('Stos jest pusty');
- exit;
- end
- else
- begin
- while pocz<>nil do
- writeln(pocz^.imie);
- writeln(pocz^.nazwisko);
- writeln(pocz^.data);
- pocz:=pocz^.wsk
- end;
- end;
- procedure usun (var pocz:lista);
- var
- del:lista;
- begin
- if pocz=nil then
- begin
- writeln ('Stos jest pusty');
- exit;
- end
- else
- begin
- del:=pocz;
- pocz:=pocz^.wsk;
- dispose(del);
- end;
- end;
- var
- dana:lista;
- n:integer;
- begin
- dana:=nil;
- repeat
- writeln('**********************************************************');
- writeln('1. Wyswietl stos');
- writeln('2. Dodaj do stosu');
- writeln('3. Usun ze stosu');
- writeln('4. Zamknij program');
- writeln('**********************************************************');
- writeln('Co wybierasz');
- readln(n);
- until n=4;
- case n of
- 1:wyswietl(dana);
- 2:dodaj(dana);
- 3:usun(dana);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement