#include <iostream>
using namespace std;
#define MAXSIZE 100
typedef int Selemtype;
typedef int Status;
#define OK 1
#define ERROR 0
#define OVERFLOW -2
typedef struct{
Selemtype *top;
Selemtype *base;
int stacksize;
}SqStack;
//算法3.1 顺序栈的初始化
Status InitStack(SqStack &S)//构造一个空栈
{
S.base=new Selemtype[MAXSIZE];
if(!S.base)
exit(OVERFLOW);
S.top=S.base;
S.stacksize=MAXSIZE;
return OK;
}
//算法3.2 顺序栈的入栈
Status Push(SqStack &S,Selemtype e)
{
if(S.top-S.base==S.stacksize)
return ERROR;//栈满
*S.top++=e;
return OK;
}
//算法3.3 顺序栈的出栈
Status Pop(SqStack &S,Selemtype &e)
{
if(S.top==S.base) return ERROR;//栈空
e=*--S.top;
return OK;
}
//算法3.4 取栈顶元素
Selemtype GetTop(SqStack S)
{
if(S.top==S.base) exit(1);
return *(S.top-1);
}
void add(SqStack L1,SqStack L2)//相加
{ int a,b,c,e,count=0;
int len1=L1.stacksize,len2=L2.stacksize;
int len&