Question: (1) (50%) Write a C program that takes as input a fully parenthesized, arithmetic expression of binary operators +, -,*,/, and converts the expression into

 (1) (50%) Write a C program that takes as input a

fully parenthesized, arithmetic expression of binary operators +, -,*,/, and converts the

(1) (50%) Write a C program that takes as input a fully parenthesized, arithmetic expression of binary operators +, -,*,/, and converts the expression into a binary expression tree. Your program should take input from the command line. The entire expression should be in a character string without any space in it An input string only includes floating numbers in the format of Y.YY, that is, one digit to the left of the decimal point and two digits to the right of the decimal point, and variables of the form of xl, x2 Your program shall allow for the leaves in the expression tree not only to store floating values but also to store variables of the form xl, x2, x3, ..., which are initially 0.0 and can be updated interactively by the user. For example, expression ((rl +5.12) (r2 7.68))/r3) will be converted into a binary expression tree like: 5.12 x2 7.68 Your program should then show a menu with the following options 1. Display 2. Preorder 3. Inorder 4. Postorder 5. Update 6. Calculate 7. Exit Description: . When option 1 is selected, your program should display the tree in some way so that the tree can be visualized, and also print the name and value of each variable, like "x1:0.0" when x1 initially has value 0.0

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!