// prog 5 - reduce a stack to get prefix expr #define ME "instructor" // reduce the expression on top of the stack to prefix form void reduce (mstr_stack & S) { mstring op, oprnd1, oprnd2, prefix; // get 'infix' off stack oprnd2=S.pop(); op=S.pop(); oprnd1=S.pop(); //cout << " in reduce" << endl; //cout << " reducing: " << A << " " << B << " " << C << endl; // create prefix prefix=op; prefix.concatenate(oprnd1); prefix.concatenate(oprnd2); // put prefix on the stack S.push(prefix); //cout << " out reduce" << endl; }