/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
struct tstack { slot vrijednost; tstack *slje; }; void InitS(tstack *stog) { stog->slje=NULL; } void PushS(slot ulaz,tstack *stog) { tstack *pom; pom=new tstack; pom->vrijednost=ulaz; pom->slje=stog->slje; stog->slje=pom; } int IsEmptyS(tstack *stog) { if (stog->slje==NULL) return(0); else return(1); } slot TopS(tstack *stog) { if (stog->slje != NULL) return((*stog->slje).vrijednost); else exit(0); } void PopS(tstack *stog) { tstack *pom; pom=stog->slje; stog->slje=pom->slje; delete(pom); }