/ 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 value; struct st *next; }; typedef struct st stack; typedef stack *element; elementtype TopS(stack *S){ element sljedeci = S->next; if (sljedeci==NULL) cout << "Stog je prazan.."; else return sljedeci->value; } void PushS(elementtype x, stack *S){ element novi = new stack; novi->value = x; novi->next = S->next; S->next = novi; } void PopS(stack *S){ element e = S->next; S->next = e->next; delete e; } void InitS(stack *S){ S->next = NULL; } bool IsEmptyS(stack *S){ if (S->next==NULL) return true; else return false; }