Write a program that reads expressions over binary


Write a program that reads expressions over binary operators +, -, *, /, ^ and parenthesis from the standard input and displays the result of evaluating the input expression to the standard output. The program must first read the priorities and associativities of each operator from the standard input. For example the following input lines describe the standard priorities and associativities

- 1 L
+ 1 L
* 2 L
/ 2 L
^ 3 R

  • Each expression is terminated by a new line
  • Operands are all integers and all operators perform integer operations
  • Your program must display an error message in case of an erroneous expression and continue to the next expression
  • The end of input is signaled by end of file (CTRL D) The program must be completed using algorithms discussed in class (using a stack that is implemented with pointers). Other methods (and possibly correct) programs will not be considered correct!!

Attachment:- projectAlgorithm.txt

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Write a program that reads expressions over binary
Reference No:- TGS01139570

Now Priced at $10 (50% Discount)

Recommended (98%)

Rated (4.3/5)