d_infixtopostfix.h

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

H
20
字号
#include<iostream>
using namespace std;
#include<stack>
#include "d_instruction.h"
#include "d_expression_error.h"

class infixToPostfix{
public:
	infixToPostfix();//默认的构造函数
	infixToPostfix(const string& infix);//初始化中辍表达式
	void setInfix(const string& infix);//设置中辍表达式
	string postfix();//返回等效于中辍表达式的后辍表达式
private:
	string infixExpression;//中辍表达式
	string postfixExpression;//后辍表达式
	stack<instruction>  commandStack;//存放算术符的栈
	void outputCommand(const instruction& instr);//输出栈中的算术符到后辍表达式中
	bool isCommand(char ch) const;//判断是不是正确的算术符
};

⌨️ 快捷键说明

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