COSC 2415 - Data Structures and
ITSE 2445 Data Structures
Bob Comer, Professor of Computer Studies
Program 4 - Translating Infix to Postfix Notation
Be sure to read through Chapter 7 of the textbook before starting this assignment.
Do Programming Project 9 at the end of Chapter 7 of the Main and Savitch textbook (page 387).
I just want you to implement the basic algorithm described in "Translating Infix to Postfix Notation" from page 375 of your textbook and Figure 7.11. The input expression should be fully parenthesized (that is, you do not have to worry about operator precedence). You must include all error-checking described in Figure 7.11, including checking for missing parentheses. If an error is detected, print an appropriate error message and ask the user to re-enter the expression.
You can assume that numbers are non-negative and begin with a digit or decimal point.
You can assume that variable names are delimited by whitespace and begin with a character.
You do not need to do the last part of the assignment in the book, where it says "For a more difficult assignment, enhance your program so that the expression need not be well formed ...".
You should use the stack template from the author's web site or from the C++ STL.
Return to Data Structures homepage
Return to ACC Homepage