Thread: VB6 Calculator
View Single Post
Old Nov 6th, 2007, 7:15 PM   #9
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: VB6 Calculator

If you're allowed strictly left to right evaluation, then go for it. Collect the first operand. Collect and save the operator. Collect the second operand. Perform the operation. The result is your new "first" operand. Collect the next operator. Collect the next operand. Perform the operation. Wash, rinse, and repeat until done.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote