#include<iostream>
#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(S.top == -1)
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 x)
{
if(S.top == -1)
return false;
x = S.data[S.top--];
printf("%d\n",x);
return true;
}
bool GetTop(SqStack S,ElemType &x)
{
if(S.top == -1)
return false;
x = S.data[S.top];
printf("%d\n",x);
return true;
}
int main()
{
SqStack s;
int m,x;
InitStack(s);
Push(s,3);
Push(s,9);
Push(s,17);
Push(s,61);
Push(s,278);
Push(s,4687);
Push(s,6785);
Push(s,768);
Push(s,45);
while(!StackEmpty(s))
{
Pop(s,x);
}
return 0;
}