C语言表达式计算器
为了方便了解流程,在程序中把计算过程也输出了.而且栈操作的实现部分也是自己实现的.[G1N$N7|1yP J(A$|程序用两个栈,optr寄存运算符,opnd寄存操作数和运算结果.输入的表达式以等号结束,例如:2*(1+2)=0Bu?~6P V E p
/**************表达式计算器************/+_Q+Ai/b
#include <stdio.h>`\1k&m1?k7Q#t
#include <stdlib.h>
#include <string.h>(iV#T6xl6dW)`!J
#include <conio.h>
#include <malloc.h>6uU2Q3V"J*h4P
#define STACK_SIZE 100
#define APPEND_SIZE 10p_b4b9oeD
@b8P^6@q8ZjZS
struct SNode{
float data; /*存放操作数或者计算结果*/r6kHUB%^ C!y
char ch; /*存放运算符*/
};
,Dlz6GJ:|P
struct Stack{
SNode *top;
SNode *base;
int size;
};o*q ?MP ^ YP
&JUxzot~NhV
/*栈操作函数*/