Blogger Widgets

Search This Blog

Saturday, 11 August 2012

Reverse Polish Calculator in C

                
                   Recently while done the exercises from KNR, I got an interesting excersise for calculator,..It is Reverse polish calculator. The major advantage of this is that this method saves our time, becouse here we can write a mathematical expression without using parentheses and brackets.
                 Here you never have to account for the parentheses while doing calculations. The process is similar to the way you learned math on paper. You can see the intermediary results as you perform your computations rather than just the answer at the end. This is an extremely helpful byproduct. Math teachers are using this feature to improve student understanding of mathematics. An intermediate result allows the user to check the results and correct errors more easily. It's easier to follow the stream of calculation. The user defines the priority of operators. RPN is logical because the user first gives the number and then tells what to do with it.

                     for eg : 
                       The reverse polish notation of (1 - 2) * (4 + 5) this
                        is entered as ----         1 2 - 4 5 + *
Blogger Widgets