/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#include <iostream> using namespace std; struct tautomobil { int sb; char proizvodac[25]; char model[20]; int godina; } automobil; struct stog { int sb[40]; char proizvodac[40][25]; char model[40][20]; int godina[40]; int kursor; }; tautomobil TopS (stog* S){ if(S->kursor != 20) { automobil.sb = S->sb[S->kursor+1]; strcpy(automobil.proizvodac, S->proizvodac[S->kursor+1]); strcpy(automobil.model, S->model[S->kursor+1]); automobil.godina = S->godina[S->kursor+1]; return automobil; } } void PushS (tautomobil a, stog* S){ if(S->kursor>=0) { S->sb[S->kursor] = a.sb; strcpy(S->proizvodac[S->kursor], a.proizvodac); strcpy(S->model[S->kursor], a.model); S->godina[S->kursor] = a.godina; S->kursor--; } } void PopS (stog* S) { if (S->kursor <= 20) S->kursor++; } stog* InitS (stog* S) { S = new stog; S -> kursor = 20; return S; } bool IsEmptyS (stog* S) { if (S->kursor == 20) return 1; else return 0; }