C语言表达式计算器
为了方便了解流程,在程序中把计算过程也输出了.而且栈操作的实现部分也是自己实现的.程序用两个栈,optr寄存运算符,opnd寄存操作数和运算结果.输入的表达式以等号结束,例如:2*(1+2)=
/**************表达式计算器************/
#include <stdio.h>np(]x \1@xA"z
#include <stdlib.h>
#include <string.h>%y[k/s(`N
#include <conio.h>
#include <malloc.h>
#define STACK_SIZE 100!B(Oi?$t5`}
#define APPEND_SIZE 10 ie&wPe jR
2qS9I9S+p'd IC
struct SNode{ l;\7cS.x
float data; /*存放操作数或者计算结果*/
char ch; /*存放运算符*/
};L:z8rF~g
8E_Lk1Mj E8z
struct Stack{&Q%Y-{TS x1TBdB
SNode *top;