中缀表达式转后缀表达式 (C++ 代码)
#include
using namespace std;
int precedence(char op) { if (op == '+' || op == '-') { return 1; } else if (op == '*' || op == '/') { return 2; } return 0; }
string infixToPostfix(string infix) {
string postfix = '';
stack
int main() { string infix; cin >> infix; string postfix = infixToPostfix(infix); cout << postfix << endl; return 0; }
原文地址: https://www.cveoy.top/t/topic/oiMm 著作权归作者所有。请勿转载和采集!