Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct auti {
- double serijski_broj;
- char proizvodac [30];
- char model_automobila[30];
- int godina_proizvodnje;
- };
- typedef auti elementtype;
- struct smth{
- elementtype vrijednost;
- struct smth *slijedeci;
- };
- typedef struct smth stog;
- void PushS(elementtype z, stog *L){
- stog *novi;
- novi=(stog *)malloc(sizeof(stog));
- novi->vrijednost=z;
- novi->slijedeci=L->slijedeci;
- L->slijedeci=novi;
- };
- elementtype TopS(stog *L){
- stog *vrh;
- if(L->slijedeci==NULL){
- cout<<"Doslo je do pogreske!! Stog je prazan!!"<<endl;
- exit(1);
- };
- vrh=L->slijedeci;
- return vrh->vrijednost;
- };
- int IsEmptyS(stog *L){
- if(L->slijedeci==NULL) return 1;
- else return 0;
- };
- void PopS(stog *L){
- stog *pri;
- if(L->slijedeci==NULL){
- cout<<"Doslo je do pogreske!! Stog je prazan"<<endl;
- exit(1);
- };
- pri=L->slijedeci;
- L->slijedeci=pri->slijedeci;
- free(pri);
- };
- stog * InitS(void){
- stog *L;
- L=(stog *)malloc(sizeof(stog));
- // L->vrijednost=0;
- L->slijedeci=NULL;
- return L;
- };
Add Comment
Please, Sign In to add comment