什么是回文?"回文数"是一种数字。如:1986891, 这个数字正读是1986891,倒读也是1986891,正读倒读一样,所以这个数字就是回文数。
#include
using namespace std;
typedef int DataType;
#define MaxListSize 10 //栈的大小
//
class SeqStack
{
DataType data[MaxListSize];
int top;
public:
SeqStack(void)
{
top = 0;
}
~SeqStack() {};
void push(const DataType& item);
DataType Pop(void);
DataType Peek(void) const; //读栈顶数据元素并返回
int StackEmpty(void) const
{
return (top == 0);
}
int GetSize(void) const
{
return top;
}
void ClearStack(void)
{
top = 0;
}
};
void SeqStack::push(const DataType& item)
{
if (top == MaxList