Return to Snippet

Revision: 35953
at November 15, 2010 10:35 by majbrlek


Initial Code
using namespace std;

struct automobil{
       int br;
       int god;
       char proizvodac[30];
       char model[30];       
};

typedef automobil elementtype;

struct st {
	   elementtype elementtypes[1000];
	   int top;
};

typedef struct st stack;

elementtype TopS(stack *S){
            if ((*S).top==999) cout << "Stog je prazan..";
            else return ((*S).elementtypes[(*S).top+1]);
}

void PushS(elementtype x, stack *S){
	 if ((*S).top<0) cout << "Stog je popunjen";
     else{
          (*S).elementtypes[(*S).top] = x;
		  (*S).top--;
	 }
}

void PopS(stack *S){
	 if ((*S).top==999) cout << "Stog je prazan..";
     else (*S).top++;
}

bool IsEmptyS(stack *S){
	 if ((*S).top==999) return true;
	 else return false;
}

void InitS(stack *S){
	 (*S).top = 999;
}

Initial URL

                                

Initial Description

                                

Initial Title
Zadatak 2-MBrlek-polje

Initial Tags

                                

Initial Language
C++