/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
using namespace std; struct automobil{ int br; int god; char proizvodac[30]; char model[30]; }; typedef automobil elementtype; struct st { elementtype elementtypes[1000]; int top; }; typedef struct st stack; elementtype TopS(stack *S){ if ((*S).top==999) cout << "Stog je prazan.."; else return ((*S).elementtypes[(*S).top+1]); } void PushS(elementtype x, stack *S){ if ((*S).top<0) cout << "Stog je popunjen"; else{ (*S).elementtypes[(*S).top] = x; (*S).top--; } } void PopS(stack *S){ if ((*S).top==999) cout << "Stog je prazan.."; else (*S).top++; } bool IsEmptyS(stack *S){ if ((*S).top==999) return true; else return false; } void InitS(stack *S){ (*S).top = 999; }