文档介绍:判断是否为回文
#include<>
#include<>
#include<>
#include<iostream>
#include<string>
using namespace std;
#define TRUE 1
#define FLASE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
typedef int Status;
typedef char SElemType;
#define STACK_INIT_SIZE 100;
#define STACKINCREMENT 10;
typedef struct
{
SElemType *base;
SElemType *top;
int stacksize;
}SqStack;
Status InitStack (SqStack &S)
{
=(SElemType * )malloc(100 * sizeof(SElemType));//修改 if(!)
exit(OVERFLOW);
= ;
= STACK_INIT_SIZE;
return OK;
}
Status GetTop(SqStack S, SElemType &e)
{
if( == )
return ERROR;
e=*( -1);
return OK;
}
Status Push(SqStack &S, SElemType e)
{
if( - >= )
{
=(SElemType *)realloc(,( +10 )*sizeof(SElemType));//修改 if(! )
exit(OVERFLOW);
=+;
+=STACKINCREMENT;
}
* ++=e;
return OK;
}
Status Pop(SqStack &S, SElemType &e)
{
if( == )
return ERROR;
e=*-- ;
return OK;
}
Status DestroyStack (SqStack &S)
{
free( );
=NULL;
=NULL;
=0;
return OK;
}
Status ClearStack (SqStack &S)
{
= ;
retu