ASSIGNMENT INFORMATION. DUE IN 8HRS

profilebrian98
Hwk3.cbp

#include <iostream> #include <stack> #include <cstdlib> using namespace std; bool is_operator(int c) { return c == '+' || c == '-' || c == '*' || c == '/'; } int main() { char c; // TO DO: Declare three stacks of char, stk1, stk2, stk3. cout << "Enter infix expression: "; while (cin >> c) // Read a character at a time from the keyboard. End when user enters CTL-D on the next line. { // TO DO: If c is not ')', push c onto stk1. } while ( ! stk1.empty() ) // As long as stk1 is not empty { char c; // TO DO: Save the character at the top of stk1 in c and pop stk1. // TO DO: If c is a lower case alphabetic character (a through z), push c onto stk3. // TO DO: Else if c is an operator, push c onto stk2. // TO DO: Else if c is '(', push the character at the top of stk2 onto stk3 and pop stk2. } cout << "\nEquivalent prefix expression is: "; // TO DO: while stk3 is not empty, send the character at the top of stk3 to cout and pop stk3. return EXIT_SUCCESS; }