用一个变量存储二元操作符计算的结果,每次计算完都要放会栈; 比较麻烦的另一个点就是字符串和数字的转换: to_string(int val); //具体可以在网上找到原型。 atoi(str.c_str); //字符串转换成整数。 class Solution { public: /** * * @param tokens string字符串vector * @return int整型 */ int evalRPN(vector<string>& tokens) { // write code here stack<string> st; int len ...