Question: C++ Develop an expression manager that can do a balanced symbol check: string expression = {(0+1)*(2+3)}; string expression = {(0+1)+[4*(2+3)]}; string expression ={(0+1)+[4*(2+3)}}; As you
C++
Develop an expression manager that can do a balanced symbol check: string expression = "{(0+1)*(2+3)}"; string expression = "{(0+1)+[4*(2+3)]}"; string expression ="{(0+1)+[4*(2+3)}}"; As you notice the expressions contain the following symbols: { , }, ( , ), [ , ]. Write a program that after it reads the above expressions will check and report whether the expression is balanced or not. Remember that { , }, ( , ), [ , ] are the only symbols that will be checked. All other characters will be ignored. Remember to use the stack STL as you process each expression. Call the method that processes the expression as follows: bool isItBalanced(string inputExpr) If there is a mismatch in the expression make sure you report the symbol of the mismatch and its actual position in the expression.
Run: Enter your expression: {(0+1)*(2+3)} Expected output: {(0+1)*(2+3)} == 1 Enter your expression: {(0+1)+[4*(2+3)]} Expected output: {(0+1)+[4*(2+3)]} == 1 Enter your expression: {(0+1)+[4*(2+3)}} Mismatch found : } at 15 Expected output: {(0+1)+[4*(2+3)}} == 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
