输入计算表达式如:(1-3)*4+10/5
输出的逆波兰式:1 3 - 4 * 10 5 / +
码代码时脸上洋溢着的神秘的微笑
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#define Stack_Init_Size 20
#define Stack_Increasement 10
typedef char Elemtype;
typedef struct{
Elemtype *base;
Elemtype *top;
int stacksize;
}sqStack;
void initStack(sqStack *s)
{
s->base=(Elemtype *)malloc(Stack_Init_Size*sizeof(Elemtype));
if(!s->base)
{
return;
}
s->top=s->base;
s->stacksize=Stack_Init_Size;
}
void push(sqStack *s,Elemtype e)
{
if(s->top-s->base>=s->stacksize)
{
s->base=(Elemtype *)realloc(s->base,(Stack_Increasement+s->stacksize)*sizeof(Elemtype));
if(!s->base)