Return to Snippet

Revision: 35913
at November 15, 2010 06:07 by masinko1


Initial 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;
};

Initial URL


Initial Description


Initial Title
Zadatak 2 biblioteka stog polje

Initial Tags


Initial Language
C++