编辑代码

#include <iostream>
using namespace std;
#define Maxsize 10
typedef struct{
    int data[Maxsize];
    int top;
}Sqstack;
void InitStack(Sqstack s){
    s.top==-1;
}
bool Push(Sqstack s,int x){
    if(s.top==Maxsize-1)
    return false;
    s.data[++s.top]=x;
    return true;
}
bool Pop(Sqstack s,int x){
    if(s.top==-1)
    return false;
    x=s.data[s.top--];
    return true;
}
int GetTop(Sqstack s){
    if(s.top==-1)
    return false;
    return s.data[s.top];
}
bool StackEmpty(Sqstack s){
    if(s.top==-1)
    return true;
    else
    return false;
}
int main() {
    Sqstack S;
    InitStack(S);
    Push(S,1);
    Pop(S,1);
    GetTop(S);
    StackEmpty(S);
	return 0;
}