#ifndef POSTFIXEVAL_H #define POSYFIXEVAL_H #include "Token.h" #include #include #include #include #include using namespace std; class PostfixEval { public: //主函数:对后缀表达式进行求值 double run(const std::vector& postfix, const unordered_map& vars = {}); private: //应用于二元操作符,如+,-,*,/,^ double apply_BO(const string& op, double a, double b); //应用于医院基本初等函数,如sin, cos, log double apply_UF(const string& func, double x); }; #endif