typedef struct
{
ElemType data[MaxSize];
int top;
}SqStack;
void InitStack(SqStack &st)
{
st.top = -1;
}
int StackEmpty(SqStack st)
{
return(st.top == -1);
}
int Push(SqStack &st,ElemType x)
{
if(st.top == MaxSize - 1)
return 0;
st.top++;
st.data[st.top] = x;
return 1;
}
int Pop(SqStack &st,ElemType x)
{
if(st.top == -1)
return 0;
x = st.data[st.top];
return 1;
}
int GetTop(SqStack &st,ElemType &x)
{
if(st.top == -1)
return 0;
x = st.data[st.top];
return 1;
}
typedef struct
{
ElemType data[MaxSize];
int top1,top2;
}DStack;