C语言表达式计算器
为了方便了解流程,在程序中把计算过程也输出了.而且栈操作的实现部分也是自己实现的.S2k7J?2_(r!R @程序用两个栈,optr寄存运算符,opnd寄存操作数和运算结果.输入的表达式以等号结束,例如:2*(1+2)=
/**************表达式计算器************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>B`y+E~-{ ~
#include <conio.h>
#include <malloc.h>
;u],lj:?V$_!J]l
#define STACK_SIZE 100~"c`O2t6\ SK
#define APPEND_SIZE 10g8t oJhGM
struct SNode{YD3b!GC:g$F#Au
float data; /*存放操作数或者计算结果*/r1{1^nB6pmFHj I
char ch; /*存放运算符*/ Y D6uAk#_
};_\F/mS,oN
h(Pj*A$lj E_
struct Stack{2\l2?5G7MP1zS
SNode *top;5A?t-NS
SNode *base;.tr,~i*P3[t
int size;B/]^7^+MUi o%k/T
};!J\ W'@Ey6z&R
N{-Jc,p
/*栈操作函数*/