C语言表达式计算器
为了方便了解流程,在程序中把计算过程也输出了.而且栈操作的实现部分也是自己实现的. Ji~)O8UI程序用两个栈,optr寄存运算符,opnd寄存操作数和运算结果.输入的表达式以等号结束,例如:2*(1+2)=
/**************表达式计算器************/X+|.xHwS:E
#include <stdio.h>
#include <stdlib.h>
#include <string.h>(ep-L uU*yo*mL;CT
#include <conio.h>
#include <malloc.h>
$x)gq w&B;a}@;D
#define STACK_SIZE 100*h+QSRq
#define APPEND_SIZE 10B9aT%zr-[Qz(S
.S'vMAa R
struct SNode{~Zf!NG
float data; /*存放操作数或者计算结果*/
char ch; /*存放运算符*/EN\+N%F&FK
};V&^HDJ9U2[
`/WXG8Y;q
struct Stack{)omjg3tPr
SNode *top;
SNode *base;
int size;6{h9r4m|6Q
};Fq A$R+t\6gy