For every postfix expression there exists a corresponding


For every postfix expression there exists a corresponding and uniquely defined infix expression that evaluates to the same number. The converse is not true. The infix expression a + b + c can be represented as either abc++ or ab+c+ in postfix. The reason for the ambiguity is the lack of brackets in the infix expression.

If the infix expression were "fully bracketed" there would be no ambiguity.Thus (a + b) + c pairs with ab+c+ and a + (b + c) pairs with abc++.

Example: the "fully bracketed" version of an expression a + b*c/d is (a + ((b*c)/d)).

The program should do:

* Take an infix expression from the standard input

* The expression must consist of digits (for numbers), symbols '(' and ')', and operations ('+', '-', '*', '/')
The terms in the expression might or might not be separated by one or several spaces, e.g. ( (56 + 32)* (16 -7))

* Convert the expression into the postfix form

* Output the postfix form to the screen

* Evaluate the resulting postfix expression

* Output the result

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: For every postfix expression there exists a corresponding
Reference No:- TGS01246394

Now Priced at $20 (50% Discount)

Recommended (92%)

Rated (4.4/5)