Question

C++ Progrmaming Ch. 5 Stacks ** Please actually help! I have asked this question three times...

C++ Progrmaming Ch. 5 Stacks

** Please actually help! I have asked this question three times now and every response has not compiled and has many errors. ***

Develop an expression manager that can do a balanced symbol check.

Your program will read three different mathematical expressions from the user that are the followings:

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 PEX5.cpp 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.

Return to me the following file by dropping in the Dropbox for Assignment5: PEX5.cpp

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

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
C++ Progrmaming Ch. 5 Stacks ** Please actually help! I have asked this question three times...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Please use the JAVA code attached as an input to the program that must be created...

    Please use the JAVA code attached as an input to the program that must be created IN JAVA. Instructions of the program: java code: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * */ import java.util.Random; public class Rand_Z3_Exp { /** * @param args the command line arguments */ public static void main(String[] args) {...

  • Please use the JAVA code attached as an input to the program that must be created IN JAVA. Instru...

    Please use the JAVA code attached as an input to the program that must be created IN JAVA. Instructions of the program: java code: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * */ import java.util.Random; public class Rand_Z3_Exp { /** * @param args the command line arguments */ public static void main(String[] args) {...

  • I NEED SAMPLE PRINT OUT AS WELL AS CODE PLEASE!!!! Objectives: To gain experience with stacks....

    I NEED SAMPLE PRINT OUT AS WELL AS CODE PLEASE!!!! Objectives: To gain experience with stacks. Documentation: Explain the purpose of the program as detail as possible - 8%. Develop a solution for the problem and mention algorithms to be used -12% List data structures to be used in solution. - 5%. Give a description of how to use the program and expected input/output - 5% Explain the purpose of each class you develop in the program. - 5%. Programming:...

  • C++: Learning Outcomes Implement two stacks and use them to implement an infix to prefix expression...

    C++: Learning Outcomes Implement two stacks and use them to implement an infix to prefix expression convertor Stacks A stack is an abstract data type which uses a sequential container and limits access to that container to one end. You may enter or remove from the container, but only at one end. Using the Linked List data structure from your last homework assignment, implement a Stack of type string. The Stack should only have one data member: the Linked List....

  • May i ask for help with this c++ problem? this is the code i have for assignment 4 question 2: #...

    may i ask for help with this c++ problem? this is the code i have for assignment 4 question 2: #include<iostream> #include<string> #include<sstream> #include<stack> using namespace std; int main() { string inputStr; stack <int> numberStack; cout<<"Enter your expression::"; getline(cin,inputStr); int len=inputStr.length(); stringstream inputStream(inputStr); string word; int val,num1,num2; while (inputStream >> word) { //cout << word << endl; if(word[0] != '+'&& word[0] != '-' && word[0] != '*') { val=stoi(word); numberStack.push(val); // cout<<"Val:"<<val<<endl; } else if(word[0]=='+') { num1=numberStack.top(); numberStack.pop(); num2=numberStack.top(); numberStack.pop();...

  • C++ Include a Stack class but DO NOT use STL stack, do not sumbit code that...

    C++ Include a Stack class but DO NOT use STL stack, do not sumbit code that is similar to www.cplusplus.com/forum/beginner/192479/ Parenthesis Balance Problem Description Compilers require parenthesis, braces, brackets, and angled brackets to be balanced. This means that every time one is opened it must also be close AND everything between the two are also balanced. Balanced: (00) oO100) (C0O Unbalanced: (DI This is easily determined by creating a stack and reading the input. When an open parenthesis is found,...

  • Using Java programming: Modify the delimiter class (provided below) so that it can "incorrectly" ...

    Using Java programming: Modify the delimiter class (provided below) so that it can "incorrectly" evaluate simple parenthesized math expressions . a) ask the user for the whole expression to solve b) Solve the expression only if there is no mismatch in the delimiters. If there is a mismatch, then output an error. If there is an error, allow the user to reenter a corrected/new expression. c) The program should be able to evaluate expressions that uses only the following basic...

  • The purpose of this problem is to gain familiarity with stacks and queues. You have three...

    The purpose of this problem is to gain familiarity with stacks and queues. You have three jugs that can hold c1, c2, and c3 liters of water, respectively. Initially, jug 1 is full and the other two jugs are empty. You can repeat the following procedure any number of times: Choose two of the jugs and pour the contents of one into the other until either the first is empty or the second is full. Your goal is to end...

  • C++ HTML files use tags enclosed in angle brackets to denote formatting instructions. For ex- ample,...

    C++ HTML files use tags enclosed in angle brackets to denote formatting instructions. For ex- ample, indicates bold, indicates italics, etc. If a web browser is displaying an HTML document that contains ‘<’ or ‘>’ then it may mistake these symbols for tags. This is a common problem with C++ files, which contain many <’s and >’s. For example, the line “#include ” may result in the browser interpreting as a tag. To avoid this problem, HTML uses special symbols...

  • Stacks and Java 1. Using Java design and implement a stack on an array. Implement the...

    Stacks and Java 1. Using Java design and implement a stack on an array. Implement the following operations: push, pop, top, size, isEmpty. Make sure that your program checks whether the stack is full in the push operation, and whether the stack is empty in the pop operation. None of the built-in classes/methods/functions of Java can be used and must be user implemented. Practical application 1: Arithmetic operations. (a) Design an algorithm that takes a string, which represents an arithmetic...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT