// // Massingill, Berna L. and Oldham, Jeffrey D. // 2000 Apr 5 // CS 1321 // // Program to convert arithmetic expression in infix notation to // equivalent expression in postfix (reverse Polish) notation. // // Input: // // A fully parenthesized arithmetic expression in infix notation, // with all terms (including variables, constants, operators, // *and parentheses*) separated by whitespace; terminated by // end-of-file. // // An expression is either: // "(" expression operator expression ")" // or // a single string (assumed to be a variable or constant) // An operator is any string. // // Output: // // If the input expression is well-formed, an equivalent // expression in postfix notation; otherwise an error message. // #include #include // has exit(), EXIT_SUCCESS, EXIT_FAILURE // ADD CODE HERE? // ---- Function prototypes. See below for comments. ---- void errorExit(void); // ADD CODE HERE? // ---- Main program. ---- int main(void) { cout << "Enter the expression to evaluate " "(multiple lines okay, control-D to end):\n"; // ADD CODE HERE cout << "\nThat's all, folks!\n"; return EXIT_SUCCESS; } // ---- Function definitions. ---- // YOU MAY FIND THESE FUNCTIONS USEFUL. // Print error message and bail out of program. void errorExit(void) { cerr << "Input expression is not well-formed.\n"; exit(EXIT_FAILURE); } // ADD CODE HERE