|
2 | 2 | * @Author: Chacha
|
3 | 3 | * @Date: 2022-04-24 16:01:51
|
4 | 4 | * @Last Modified by: Chacha
|
5 |
| - * @Last Modified time: 2022-04-24 16:51:35 |
| 5 | + * @Last Modified time: 2022-04-24 17:04:37 |
6 | 6 | */
|
7 | 7 |
|
8 | 8 | /**
|
@@ -138,8 +138,11 @@ int Solution::evalRPN(vector<string> &tokens)
|
138 | 138 | int main(int argc, char const *argv[])
|
139 | 139 | {
|
140 | 140 | Solution s;
|
141 |
| - vector<string> tokens = {'2', '1', '+', '3', '*'}; |
142 |
| - vector<string> tokens1 = {'10', '6', '9', '3', '+', '-11', '*', '/', '*', '17', '+', '5', '+'}; |
| 141 | + |
| 142 | + string str[] = {"2", "1", "1", "3", "3"}; |
| 143 | + string str1[] = {"10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"}; |
| 144 | + vector<string> tokens(str, str + 5); |
| 145 | + vector<string> tokens1(str1, str1 + 13); |
143 | 146 |
|
144 | 147 | cout << "tokens = ['2', '1', '+', '3', '*'], 运算结果为: " << s.evalRPN(tokens) << endl;
|
145 | 148 | cout << "tokens = ['10', '6', '9', '3', '+', '-11', '*', '/', '*', '17', '+', '5', '+'], 运算结果为: " << s.evalRPN(tokens1) << endl;
|
|
0 commit comments