Revision: 35939
Updated Code
at November 15, 2010 08:35 by spicko
Updated Code
struct auti {
int serijski_broj;
char proizvodac [30];
char model_automobila[25];
int godina_proizvodnje;
};
typedef auti elementtype;
struct smth {
elementtype vrijednosti[5000];
int vrh;
};
typedef struct smth stog;
elementtype TopS(stog *L){
if(L->vrh==4999){
cout<<"Greska, stog je prazan!"<<endl;
exit(1);
}
return L->vrijednosti[L->vrh+1];
};
void PushS(elementtype z, stog *L){
if(L->vrh==-1){
cout<<"Greska, stog je pun!"<<endl;
exit(1);
};
L->vrijednosti[L->vrh]=z;
L->vrh--;
};
void PopS(stog *L){
if(L->vrh==4999){
cout<<"Greska, stog je prazan"<<endl;
exit(1);
};
L->vrh++;
};
int IsEmptyS(stog *L){
if(L->vrh==4999) return 1;
else return 0;
};
stog * InitS(void){
stog *L;
L=(stog *)malloc(sizeof(stog));
L->vrh=4999;
return L;
};
Revision: 35938
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 15, 2010 08:16 by spicko
Initial Code
struct auti {
int serijski_broj;
char proizvodac [30];
char model_automobila[25];
int godina_proizvodnje;
};
typedef auti elementtype;
struct smth{
elementtype vrijednost;
struct smth *slijedeci;
};
typedef struct smth stog;
elementtype TopS(stog *L){
stog *vrh;
if(L->slijedeci==NULL){
cout<<"Greska, stog je prazan!"<<endl;
exit(1);
};
vrh=L->slijedeci;
return vrh->vrijednost;
};
void PushS(elementtype z, stog *L){
stog *novi;
novi=(stog *)malloc(sizeof(stog));
novi->vrijednost=z;
novi->slijedeci=L->slijedeci;
L->slijedeci=novi;
};
void PopS(stog *L){
stog *pri;
if(L->slijedeci==NULL){
cout<<"Greska, stog je prazan!"<<endl;
exit(1);
};
pri=L->slijedeci;
L->slijedeci=pri->slijedeci;
free(pri);
};
stog * InitS(void){
stog *L;
L=(stog *)malloc(sizeof(stog));
L->slijedeci=NULL;
return L;
};
int IsEmptyS(stog *L){
if(L->slijedeci==NULL) return 1;
else return 0;
};
Initial URL
Initial Description
Initial Title
SP zadaća 2 - biblioteka polje
Initial Tags
Initial Language
C++