Opus5.Application1

Explanation

This application uses a stack to implement an RPN calculator. It uses the calculator method given in Program 6.12.

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.

The input is a reverse-Polish expression of the following form: The expression may contain only single-digit integers, the addition operator +, and the multiplication operator *. In addition, the = operator pops the top value of the stack and prints it on the output screen.

For example, the input 3 4 + = will cause the program to compute and print 7.


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