Skip to content

Instantly share code, notes, and snippets.

@pjhyett
Created July 15, 2008 19:05
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save pjhyett/7 to your computer and use it in GitHub Desktop.
Save pjhyett/7 to your computer and use it in GitHub Desktop.
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
Copy link

">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment