#include<stdio.h>
#include<stdlib.h>
#define MaxSize 10
//定义栈
typedef struct{
int data[MaxSize]; //存放栈中元素
int top; //栈顶指针
}SqStack;
//初始化栈
void InitStack(SqStack &S){
S.top=-1; //初始化栈顶指针
}
//判断栈空
bool StackEmpty(SqStack S){
if(S.top=-1){
return true;
}else{
return false;
}
}
//入栈
bool Push(SqStack &S,int x){
if(S.top=MaxSize-1){ //判断栈是否已满
return false;
}
S.top+=1;
S.data[S.top]=x;
return true;
}
//出栈
bool Pop(SqStack &S,int &x){
if(S.top=-1){ //判断栈空
return false;
}
x=S.data[S.top];
S.top-=1;
return true;
}
//读栈顶元素
bool GetTop(SqStack S,int &x){
if(S.top=-1){ //判断栈空
return false;
}
x=S.data[S.top];
return true;
}
//主函数
int main(){
}