#include "stdstuff.h" #include "Parser.h" int main () { String2002 str; ExpTreeNode *root; for (;;) { cout << "\nEnter an expression (STOP to terminate).\n: "; cin >> str; // convert to upper case for (int i = 0; i < str.length(); i++) { str[i] = (char) toupper(str[i]); } if (str == "STOP") { pause(); return 0; } cout << endl; // space the output if ((root = createExpTree ((String2002) str)) == NULL) { cout << "That is not a valid expression.\n"; } else { cout << "The expression is valid. Its value is " << evaluateExpTree(root) << ".\n"; cout << "Infix form "; outputInfixExpression (root); cout << endl; cout << "Postfix form "; outputPostfixExpression (root); cout << endl; deleteExpTree (root); } } }