Created
July 15, 2008 19:05
-
-
Save pjhyett/7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
">