C语言表达式计算器
为了方便了解流程,在程序中把计算过程也输出了.而且栈操作的实现部分也是自己实现的.程序用两个栈,optr寄存运算符,opnd寄存操作数和运算结果.输入的表达式以等号结束,例如:2*(1+2)=NWzC]{S
/**************表达式计算器************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>T(y5P"T/YZT^~+F
#include <conio.h>4W oO;c3jP4g
#include <malloc.h>
#define STACK_SIZE 100Xa4Q#\ P7BRS7kCkr
#define APPEND_SIZE 10(K#Ro f9R*r8t"l
2Q*pY+N6C5R&rO
struct SNode{
float data; /*存放操作数或者计算结果*/
char ch; /*存放运算符*/0`Xgx+q1h
};
struct Stack{
SNode *top;
SNode *base;