Using Stacks In C++ for infix and postfix expressions
问题 I'm writing a program that takes user input and uses stacks to convert an infix expression into a postfix expression based on precedence, with operands always going before operators. For example, if a user inputs: (a+b*c) then the program should display: abc*+ so far, I have this: #include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<char> s; char input; while (cin.get(input) && input != '\n') { if (isalnum(input)) cout << input << "\n"; else if (input