Question: Write a program that evaluates postfix expressions entered interactively from the keyboard that adheres to the following specification: Function: The program evaluates postfix arithmetic expressions

Write a program that evaluates postfix expressions entered interactively from the keyboard that adheres to the following specification:
Function: The program evaluates postfix arithmetic expressions containing real numbers and the operators +,-* and /.
Input: The input is a series of arithmetic expressions entered interactively from the keyboard in postfix notation. The user is prompted to enter an expression made up of operators (the characters '+','-','*', and ') and numbers. You can assume that the numbers are one digit numbers (0-9). They must be read in as characters because the operators are read in as characters), and converted to numbers. The user terminates the program by entering the character "#" instead of a new expression.
Output: The user is prompted for each new expression to be evaluated with the following prompt:
"Enter expression to evaluate or a # to quit." After the evaluation of each expression, the
results are printed to the screen: "Result = value" where value is the result of the postfix
expression (a real number).

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!