Many early calculators used a post-fix entry to perform


Many early calculators used a post-fix entry to perform arithmetic calculations. For example 2 + 3 in in-fix notation would be 2 3 + in post-fix notation. ( 2 + 3 ) * 4, would be 2 3 + 4 *. Utilizing a stack, post-fix expressions are very easily evalauted.

If an entry is numeric, simply push it on the stack. If an entry is an operator, pop the top two elements from the stack, perform the operation, and push the result on the stack. You must write a C# program that asks a user for input and evaluates an expression using this technique. For example:

Enter your post-fix expression: 5 6 + 4 5 * +

Answer: 31

 

Solution Preview :

Prepared by a verified Expert
Programming Languages: Many early calculators used a post-fix entry to perform
Reference No:- TGS01245434

Now Priced at $20 (50% Discount)

Recommended (92%)

Rated (4.4/5)