Friday, July 31, 2009

Hello 2 all my question is that what is the best algo for making a calculator in C++ shortest?

and most effective

Hello 2 all my question is that what is the best algo for making a calculator in C++ shortest?
What you are talking about is not an algorithm, but in fact a complete program. Time to get coding!!!
Reply:the shortest way is to cheat! by that I mean you could do a number parser and a subroutine for each operation.. and call the right routines.... but that's hardly short





short would be to find a module that can evaluate a string of numbers and expressions and return the value!


"1+2+3" = 6





most languages have this kind of thing built in... c++ may not!





If you write that function first... you can use it along the way to see what the current value is.





it can simplify the program.


No comments:

Post a Comment