Question: C++ Programming Exercise Assignment 7.2 [20 points] Do programming problem 6 from chapter 6 of the text. Use the pseudocode algorithm that evaluates postfix expressions

C++ Programming Exercise

C++ Programming Exercise Assignment 7.2 [20 points] Do programming problem 6 fromchapter 6 of the text. Use the pseudocode algorithm that evaluates postfix

Assignment 7.2 [20 points] Do programming problem 6 from chapter 6 of the text. Use the pseudocode algorithm that evaluates postfix expressions given at the end of section 6.3.1 and the pseudocode algorithm that converts an infix expression to postfix form given near the end of section 6.3.2. Use the STL stack class. The problem says to "Design and implement a class of infix calculators," but it seems to me that it makes more sense to simply write a function named "evaluateInfix" that evaluates infix expressions. It should have one string parameter and should return an int result. It should call a separate function named "infixToPostfix" to convert the infix expression into a postfix expression, and then it should do the work of evaluating the resulting postfix expression. Then write a main() function to thoroughly test the function. Consider simple infix expressions that consist of single-digit operands; the operators +, -, *, and/; and paren- theses. Assume that unary operators are illegal and that the expression contains no embedded spaces. Design and implement a class of infix calculators. Use the algorithms given in this chapter to evaluate infix expressions as entered into the calculator. You must first convert the infix expression to postfix form and then evaluate the resulting postfix expression. Assignment 7.2 [20 points] Do programming problem 6 from chapter 6 of the text. Use the pseudocode algorithm that evaluates postfix expressions given at the end of section 6.3.1 and the pseudocode algorithm that converts an infix expression to postfix form given near the end of section 6.3.2. Use the STL stack class. The problem says to "Design and implement a class of infix calculators," but it seems to me that it makes more sense to simply write a function named "evaluateInfix" that evaluates infix expressions. It should have one string parameter and should return an int result. It should call a separate function named "infixToPostfix" to convert the infix expression into a postfix expression, and then it should do the work of evaluating the resulting postfix expression. Then write a main() function to thoroughly test the function. Consider simple infix expressions that consist of single-digit operands; the operators +, -, *, and/; and paren- theses. Assume that unary operators are illegal and that the expression contains no embedded spaces. Design and implement a class of infix calculators. Use the algorithms given in this chapter to evaluate infix expressions as entered into the calculator. You must first convert the infix expression to postfix form and then evaluate the resulting postfix expression

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!