Faria R.
asked 08/12/21Our whole class cannot slovingit,please help sir,Use Application of Stack and Queue .
Question: Write a code in C++ [using object oriented approach] that will take a mathematical expression as input and output whether the parentheses are balanced or not in the expression. [10 points]
Sample Input: (5 + (9-(3+2))+ 4)
Sample Output: Balanced
Sample Input: (5 + (9-(3+2)+ 4)
Sample Output: Not Balanced
Note:[using object oriented approach]
[NOTE]
Sir,last time your this code was not compiled and show several errors.
Mail:Fariamahbub630@gmail dot com ,send the code when it is complied.Thank u.
1 Expert Answer

Patrick B. answered 08/12/21
Math and computer tutor/teacher
Ok let me get my crystal ball so I can see what YOUR compiler says on YOUR screen....
Oh lookie here, winning lottery numbers...
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Faria R.
using namespace std; #include #include #include #include /**************************************** * if LEFT PARENTHESIS '(' is encountered: pushes onto the stack... *if RIGHT PARENTHESIS ')' is encountered: if the stack is empty, then NOT BALANCED !!! (too many RIGHT PARENTHESIS) otherwise pops off th stack; * AFTER the loop if the stack is empty, then the parenthesis are BALANCED! Otherwise they are not!! (too many LEFT Parenthesis) **************************************************************/ DoStack(char * mathExpression) { cout << "** Using the STACK to Verify that the parenthesis are BALANCED *** "<< endl; cout << "The math expression is:>"< _stack; int x=1; bool boolBalancedFlag = true; for (int iLoop=0; iLoop"< Q; int x=1; for (int iLoop=0; iLoop08/12/21