Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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


 image

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

More Books

Students also viewed these Computer Network questions

Question

Find (4.2 + 4x + 6x) dx + C

Answered: 1 week ago