#include <iostream>
#include <time.h>
#include <cstdlib>
using namespace std;
struct stos{
int liczba;
stos* next;
};
void push(stos**top);
void wyswietlanie(stos*top);
int generowanie();
void usuwanie(stos**top);
int main()
{
cout << "Kacper Walenkiewicz" <<endl;
int x,n;
bool br=true;
stos* top = NULL;
do{
cout<<endl<<"---------Menu---------\n1.Sprawdzenie czy stos jest pusty\n2.Dodanie el. na stos\n3.Usuniecie el. ze stosu\n4.Pobranie el. ze stosu\n5.Wyjscie\nWybor: ";
cin>>x;
switch(x){
case 1:
if(top==NULL) cout<<endl<<"Stos jest pusty"<<endl;
else cout<<endl<<"Stos nie jest pusty"<<endl;
break;
case 2:
push(&top);
break;
case 3:
if(top==NULL) cout<<endl<<"Stos jest pusty"<<endl;
else {
usuwanie(&top);
}
break;
case 4:
if(top==NULL) cout<<endl<<"Stos jest pusty"<<endl;
else {
wyswietlanie(top);
}
break;
case 5:
br=false;
break;
}
}while(br==true);
return 0;
}
int generowanie(){
srand(time(NULL));
int liczba=rand()%(10)+1;
return liczba;
}
void push(stos**top){
stos* nowyStos=new stos;
nowyStos->liczba=generowanie();
nowyStos->next=*top;
*top=nowyStos;
}
void wyswietlanie(stos*top){
cout<<endl<<"Element na wierzchu:"<<top->liczba<<endl;
}
void usuwanie(stos**top){
stos *temp= *top;
*top= (*top)->next;
delete temp;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}