Question: Please write a program that can evaluate an infix arithmetic expressions involving doubles combined with +, -, *, /, and ^ operators as well


Please write a program that can evaluate an infix arithmetic expressions involving doubles combined with +, -, *, /, and ^ operators as well

Please write a program that can evaluate an infix arithmetic expressions involving doubles combined with +, -, *, /, and ^ operators as well as parenthesis. The parenthesis does NOT have to be fully balanced. For example:( 2 * 3^2). The fully parenthesized version of this expression would be (2* (3^2)) However, make sure that: Each such expression always has one opening parenthesis and one closing parenthesis. For example, you need to represent as (2+3) not 2 + 3. *Numbers and operators including parenthesis are all separated by a space. Please do not first convert the infix expression into postfix, and then evaluate the postfix. Hints: You need to have two stacks for this problem.One stack is to hold all operators, and the other is to hold numbers. Here shows a working algorithm for you reference: Problem 6: Simple Calculator Write a program prompts the user to enter two integer values and the symbol of an arithmetical operator (+,-, *, /, %). The program then uses the switch statement to print the result of arithmetical operation, otherwise the program displays the message "Invalid symbol". Sample input/ output: Enter tuo integers: 59 Enter the symbol of an arithmetical operator (+,-, , , x): + 5 9 14 Enter tuo integers: 59 Enter the symbol of an arithmetical operator (+, -, 59 Invalid symbol!!! /. x): ^ C++

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 Computer Network Questions!