Question: C++ Program A. (Convert infix to postfix) Write a function that converts an infix expression into a postfix expression using the following header. string infixToPostfix(const
C++ Program
A. (Convert infix to postfix) Write a function that converts an infix expression into a postfix expression using the following header.
string infixToPostfix(const string& expression)
For example, the function should convert the infix expression
(1 + 2) * 3 to 1 2 + 3 *
and 2 * (1 + 3) to 2 1 3 + *.
B. Postfix notation is a way of writing expressions without using parentheses. For example, the expression (1 + 2) * 3 would be written as 1 2 + 3 *. A postfix expression is evaluated using a stack. Scan a postfix expression from left to right. A variable or constant is pushed to the stack. When an operator is encountered, apply the operator with the top two operands in the stack and replace the two operands with the result. The following diagram shows how to evaluate 1 2 + 3 *.

12+3 12+3 12+3 12+3 12+3 scanned scanned scanned scanned
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
