- 24
- 0
- 约2.81千字
- 约 3页
- 2017-06-09 发布于北京
- 举报
#includestdio.h
#includestdlib.h
#include string.h
#define STACK_INIT_SIZE 100
#define STACKCREMENT 10
#define OPSIZE 7
#define ERROR 0
#define OK 1
#define OVERFLOW -1
unsigned char Prior[7][7] = { // 算符间的优先关系
,,,,,,,
,,,,,,,
,,,,,,,
,,,,,,,
,,,,,=, ,
,,,, ,,,
,,,,, ,=
};
char OP[OPSIZE]={+,-,*,/,(,),#};
typedef struct{
float *base;
float *top;
int stacksize;
}SqStack;
//建立空栈
int InitStack(SqStack S){
S.base=(float *)malloc(STACK_INIT_SIZE*sizeof(float));
if(!S.base)
exit(OVERFLOW);
S.top=S.base;
S.stacksize=STACK_INIT_SIZE;
return O
原创力文档

文档评论(0)