#include<stdio.h>
#include<stdlib.h>
#define MaxSize 50
typedef int ElemType;
typedef struct {
ElemType data[MaxSize];
int top;
}SqStack;
void InitStack(SqStack &S){
S.top = -1;
}
bool StackEmpty(SqStack &S){
if(-1==S.top){
return true;
} else
return false;
}
bool Push(SqStack &S,ElemType x){
if(S.top==MaxSize-1){
return false;
}
S.data[++S.top]=x;
return true;
}
bool Pop(SqStack &S,ElemType &m){
if(StackEmpty(S)){
return false;
}
m = S.data[S.top–];
return true;
}
bool GetTop(SqStack S,ElemType &m){
if(StackEmpty(S)){
return false;
}
m = S.data[S.top];
return true;
}
int main(){