Question: Write an infix to postfix converter as described in chapter 6. Use code from chapter 7 to implement a stack (can be array based or

Write an infix to postfix converter as described in chapter 6. Use code from chapter 7 to implement a stack (can be array based or linked based).

Assume:

1. variables are single character from a to z (lowercase)

2. There are no unary minus or plus

3. There are no spaces

Put in error detection that would detect variables together (like bb+c), operators together (like b++c), or mismatched parenthesis. It is recommended to use a Boolean, like validExp, to signal that the expression is incorrect. Also recommended to use another Boolean to keep track of the type of character gotten from the string, like previousOperand for the fact that a variable had been processed and the next should be an operator: note, with parenthesis, check the previousOperand but do NOT set it. For instance, (a+b) is valid while a(+b) is not checking that the previousOperand is true would generate an error for a(+b).

The program should input the infix expression, then either print an error or print the postfix expression. Use C++ and do not write anything if you are not going to fallow the rules and just copy paste from the web. Thanks. I really need your help.

Textbook is Data Abstraction and Problem solving by C++ 6th edition

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!