/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#include<iostream> using namespace std; struct tskladiste { int serijskibr; char proizvodac[20]; char model[20]; int godpro; }automobil; //struct struct stog { int serijskibr; char proizvodac[20]; char model[20]; int godpro; stog *sljedeci; }; //struct tskladiste TopS(stog *S) { if (S->sljedeci) { automobil.serijskibr = S->sljedeci->serijskibr; strcpy(automobil.proizvodac, S->sljedeci->proizvodac); strcpy(automobil.model, S->sljedeci->model); automobil.godpro = S->sljedeci->godpro; return automobil; } } //TopS void PushS(tskladiste x, stog *S) { stog* novi=new stog; novi->serijskibr=x.serijskibr; strcpy(novi->proizvodac, x.proizvodac); strcpy(novi->model, x.model); novi->godpro = x.godpro; novi->sljedeci=S->sljedeci; S->sljedeci=novi; }; //PushS void PopS(stog *S){ if (S->sljedeci) { stog* tekuci=S->sljedeci; S->sljedeci=tekuci->sljedeci; delete tekuci; } }; //PopS stog* InitS(stog *S) { S = new stog; S->sljedeci = NULL; return S; } //InitS bool IsEmptyS(stog *S){ if (S->sljedeci) return 0; else return 1; } //IsEmptyS