View Single Post
Old 05-12-2008, 04:03 AM   #40 (permalink)
templar
Zewbie
 
Join Date: May 2008
Posts: 1
Reputation: 10
Default

if your looking for an easy way to make a calculator the best advice i can give is take a look at the shunting yard algorithm (check wiki)

this is a infix to postfix converter (which should be about 30 lines of code if done properly with functions), its just a matter of setting up operand precdence as well having good knowledge on stacks and knowning when to push and when to pop. once you have it in postfix, a simple postfix parser can easily compute the equation. the beauty with SYA algorithm once you convert, order of operators is basically removed and so are brackets,

cheers
-templar-



templar is offline   Reply With Quote