/ Published in: C++

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
struct auti { int serijski_broj; char proizvodac [30]; char model_automobila[25]; int godina_proizvodnje; }; typedef auti elementtype; struct smth { elementtype vrijednosti[5000]; int vrh; }; typedef struct smth stog; elementtype TopS(stog *L){ if(L->vrh==4999){ cout<<"Greska, stog je prazan!"<<endl; exit(1); } return L->vrijednosti[L->vrh+1]; }; void PushS(elementtype z, stog *L){ if(L->vrh==-1){ cout<<"Greska, stog je pun!"<<endl; exit(1); }; L->vrijednosti[L->vrh]=z; L->vrh--; }; void PopS(stog *L){ if(L->vrh==4999){ cout<<"Greska, stog je prazan"<<endl; exit(1); }; L->vrh++; }; int IsEmptyS(stog *L){ if(L->vrh==4999) return 1; else return 0; }; stog * InitS(void){ stog *L; L=(stog *)malloc(sizeof(stog)); L->vrh=4999; return L; };
Comments
