C语言表达式计算器
为了方便了解流程,在程序中把计算过程也输出了.而且栈操作的实现部分也是自己实现的.(nt.n/^ J9}程序用两个栈,optr寄存运算符,opnd寄存操作数和运算结果.输入的表达式以等号结束,例如:2*(1+2)=
/**************表达式计算器************/
#include <stdio.h>.T2d!Gy6sm@
#include <stdlib.h>wX.mu5w9g?r6v(Z
#include <string.h>
#include <conio.h>(Rh.T8Mz7A3O
#include <malloc.h>
d'ctch
#define STACK_SIZE 100
#define APPEND_SIZE 10
struct SNode{
float data; /*存放操作数或者计算结果*/
char ch; /*存放运算符*/o8d~+m(E A9Uc,{3B
};yebEuT M
?@ s6qd
struct Stack{
SNode *top;+toG\)No
SNode *base;
int size;
};8uO6j:k#B [J n