d_postfixeval.h

来自「后辍表达式的计算」· C头文件 代码 · 共 21 行

H
21
字号
#include<iostream>
using namespace std;
#include<stack>
#include<string>
#include "d_infixToPostfix.h"
class postfixEval{
public:
	postfixEval();//默认的构造函数
	string getPostfix() const;//获得后辍表达式
	void setPostfix(const string& postfix);//设置后辍表达式
	double evaluate();//最后的值
private:
	string postfixExpression;//后辍表达式
	stack<double> operandStack;//存放操作数的栈
	void getOperands(double& left,double& right);//获得操作数
	double compute(double left,double right,char command) const;//计算
	bool isCommand(char command) const;//判断是不是操作数
};


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?