Thursday, August 11, 2011

C++ Help with example program?

Sorry to break it to you, but your approach seems to be incredibly inelegant. I would suggest coming up with a generalized solution that works for any number of variables and is way less messy. I myself wrote something very similar in Java a few months back, using recursive functions. The recursive solution makes sense because you can consider the options to be the leaves of a tree structure, and each recursive call goes one step deeper in the tree.

No comments:

Post a Comment