Return to Snippet

Revision: 37888
at December 19, 2010 08:04 by toslunjsk


Initial Code
#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

Initial URL


Initial Description


Initial Title
stog_pokazivac.h

Initial Tags


Initial Language
C++