Question: Write a program that reads repeatedly from the keyboard a prefix expression, converts it to a fully parenthesized infix expression, and determines the value of

Write a program that reads repeatedly from the keyboard a prefix expression, converts it to a fully parenthesized infix expression, and determines the value of the expression. Your program must use a stack. Assume each entered prefix expression contains only TB13 integer numbers and the *,1,+,- operators. After reading and processing a prefix expression, your program should ask the user if he/she wants to enter another expression as shown in the example below. Example: Enter a prefix expression:+5*102 The corresponding infix expression is: (5+(10*2)) and its value is 25 Do you want to enter another expression (Y/N)? Y Enter a prefix expression: /*32-74 The corresponding infix expression is: ((3*27(7-4)) and its value is 2 Do you want to enter another expression (Y/N)? N

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 Programming Questions!