Question: Write a program that takes as input an infix expression and outputs the equivalent postfix expression. The basic algorithm is contained in Translating Infix to

 Write a program that takes as input an infix expression and

Write a program that takes as input an infix expression and outputs the equivalent postfix expression. The basic algorithm is contained in "Translating Infix to Postfix Notation" on page 379. Assume that the input may contain numbers; variables; arithmetic operations +, -, *, and/; as well as parentheses. However, the expression need not be fully parenthesized, and when parentheses are missing, the usual C++ precedence rules are used to determine the order of evaluation. Your program should allow the user to enter additional expressions until the user says he or she wishes to end the program. For a more difficult assignment, enhance your program so that the expression need not be well formed; if it is not well formed, then the user is asked to reenter the 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!