Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
struct tauto {
int sb;
char pro[30];
char mod[30];
int god;
} auto;
struct stack {
int sb[21];
char pro[21][30];
char mod[21][30];
int god[21];
int cursor;
};
tauto TopS (stack* S){
if(S->cursor != 20) {
auto.sb = S->sb[S->cursor+1];
strcpy(auto.pro, S->pro[S->cursor+1]);
strcpy(auto.mod, S->mod[S->cursor+1]);
auto.god = S->god[S->cursor+1];
return auto;
}
}
void PushS (tauto x, stack* S){
if(S->cursor>=0) {
S->sb[S->cursor] = x.sb;
strcpy(S->pro[S->cursor], x.pro);
strcpy(S->mod[S->cursor], x.mod);
S->god[S->cursor] = x.god;
S->cursor--;
}
}
void PopS (stack* S) {
if (S->cursor <= 20)
S->cursor++;
}
stack* InitS (stack* S) {
S = new stack;
S -> cursor = 20;
return S;
}
bool IsEmptyS (stack* S) {
if (S->cursor == 20) return 1;
else return 0;
}
@adeelbhae

This comment has been minimized.

Copy link

commented Nov 12, 2013

">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.