typedef int SElemType ;
#define MAXSIZE 100
typdef struct {
SElemType data[MAXSIZE];
int top;
}SqStack;
bool Push(SqStack *S, SElemType e)
{
if(S->top == MAXSIZE -1)
{
return false;
}
s->top ++;
S->data[S->top] = e;
return true;
}
bool Pop(SqStack *S, ElemType *e)
{
if(S->top == -1)
{
return false;
}
*e = S->data[S->top];
S->top--;
return true;
}
SElemType data[MAXSIZE];
int top1;
int top2;
}SqDoubleStack;
bool Push(SqDoubleStack *S, SElemType e, int StackNumber)
{
if(S -> top1 + 1 == S -> top2)
return false;
if(StackNumber == 1)
{
S->data[++S->top1] = e;
}
else if(StackNumber == 2)
{
S->data[S->top2] = e;
}
return true;
}
bool Pop(SqDoubleStack *S, SElemType *e, int StackNumber)
{
if(StackNumber == 1)
{
if(S->top1 == -1)
{
return false;
}
*e = S->data[S->top1--];
}
else if(StackNumber == 2)
{
if(S->top2 == -1)
{
return false;
}
*e = S->data[S->top2++];
}
return true;
}
#define MAXSIZE 100
typdef struct {
SElemType data[MAXSIZE];
int top;
}SqStack;
bool Push(SqStack *S, SElemType e)
{
if(S->top == MAXSIZE -1)
{
return false;
}
s->top ++;
S->data[S->top] = e;
return true;
}
bool Pop(SqStack *S, ElemType *e)
{
if(S->top == -1)
{
return false;
}
*e = S->data[S->top];
S->top--;
return true;
}
//共享栈的结构定义
SElemType data[MAXSIZE];
int top1;
int top2;
}SqDoubleStack;
bool Push(SqDoubleStack *S, SElemType e, int StackNumber)
{
if(S -> top1 + 1 == S -> top2)
return false;
if(StackNumber == 1)
{
S->data[++S->top1] = e;
}
else if(StackNumber == 2)
{
S->data[S->top2] = e;
}
return true;
}
bool Pop(SqDoubleStack *S, SElemType *e, int StackNumber)
{
if(StackNumber == 1)
{
if(S->top1 == -1)
{
return false;
}
*e = S->data[S->top1--];
}
else if(StackNumber == 2)
{
if(S->top2 == -1)
{
return false;
}
*e = S->data[S->top2++];
}
return true;
}