(C++)Please implement the function evaluatePostfix based upon the algorithm give
ID: 3691642 • Letter: #
Question
(C++)Please implement the function evaluatePostfix based upon the algorithm given in the code...
int evaluatePostfix (string postFix)
{
/* algorithm:
Declare a stack of int to store the operands, and also the result of the subexpression
scan the expression from left to right, char by char
i) if the char is a digit, push the digit's value into the stack...furt
hermore, loop to read digits until you reach space or operator, and meanwhile finds out the values of the operand...
ii) if the char is an operand, pop two elements from the stack
and apply the operation on the two elements,
push the result onto the stack
when reaching the end of the expression, the value in the stack is the result */
}