波兰式表达式(后缀表达式)求值

#define _CRT_SECURE_NO_WARNINGS 1
using namespace std;
#include
#include

#include
#include
#include

//力扣

/*
题目要求:
根据逆波兰表示法,求表达式的值。
有效的运算符包括 +, -, *, / 。每个运算对象可以是整数,
也可以是另一个逆波兰表达式。
*/

/*
解题思路:
创建一个栈,若是数字则将这个数字压栈,若是符号则将栈顶两个元素取出分别作为左右操作数进行运算后入栈
*/
class Solution {
public:
    int evalRPN(vector& tokens)//tokens是一个由string类构造的vector
    {
        stack  s;
        int left, right;
        int i = 0;
        for (i; i

当前标题:波兰式表达式(后缀表达式)求值
浏览地址:http://pwwzsj.com/article/iijhog.html