堆栈判断回文

来源:百度知道 编辑:UC知道 时间:2024/05/31 14:38:08
不需要新的思路 只需要帮我找出错误#include"stdio.h"
#define MaxSize 100
#define ElemType char
typedef struct
{
ElemType data[MaxSize];
int top;
}SeqStack;

void StackInitial(SeqStack *pS)
{
pS->top=-1;
}

int IsEmpty(SeqStack *pS)
{
return pS->top==-1;
}

int IsFull(SeqStack *pS)
{
return pS->top>=MaxSize-1;
}

void Push(SeqStack *pS,ElemType e)
{
if(IsFull(pS))
{
printf("Full");
exit(1);
}
pS->data[++pS->top]=e;
}

ElemType Pop(SeqStack *pS)
{
if(IsEmpty(pS))
{
printf("Empty");
exit(1);
}
return pS->data[pS->top--];
}

ElemType GetTop(SeqStack *pS)
{
if(IsEmpty(pS))
{
printf("Empty");
exit(1);
}
return pS->data[pS->to

#include"stdio.h"
#include<stdlib.h>///////////////////
#define MaxSize 100
#define ElemType char
typedef struct
{
ElemType data[MaxSize];
int top;
}SeqStack;

void StackInitial(SeqStack *pS)
{
pS->top=-1;
}

int IsEmpty(SeqStack *pS)
{
return pS->top==-1;
}

int IsFull(SeqStack *pS)
{
return pS->top>=MaxSize-1;
}

void Push(SeqStack *pS,ElemType e)
{
if(IsFull(pS))
{
printf("Full");
exit(1);
}
pS->data[++pS->top]=e;
}

ElemType Pop(SeqStack *pS)
{
if(IsEmpty(pS))
{
printf("Empty");
exit(1);
}
return pS->data[pS->top--];
}

ElemType GetTop(SeqStack *pS)
{
if(IsEmpty(pS))
{
printf("Empty");
exit(1);
}
return pS->