Opus5.Application6

Explanation

This application illustrates the use of a binary tree to convert a postfix expression to an infix expression. It uses the ExpressionTree class given in Program 9.25 and Program 9.26.

The source code for the main method is available here.

Instructions

This is an interactive application. Type your input in the white text area underneath the "screen" below. Press Enter to cause the input in the text area to be passed to the application. Terminate your input by typing Control-D.

The input is a reverse-Polish expression of the following form: The expression may contain only single-digit integers, single-letter variables, the binary operators +, *, *, and /. The output is the same expression converted to infix notation.

For example, the input a b c + * will cause the program to compute and print ((a)*((b)+(c))). (Remember to terminate your input with Control-D).


Bruno
Copyright © 1999 by Bruno R. Preiss, P.Eng. All rights reserved.