Sunday, July 12, 2009

When dealing with fractions in C++ should I use a pre-test loop, post-test loop or switch statement?

I am going to add, subtract, multiply and divide these fractions

When dealing with fractions in C++ should I use a pre-test loop, post-test loop or switch statement?
You need to be more specific on what you need to do with the fractions. If it is simple division I would use a switch statement so that you do not divide by zero.





A pre-test loop will also work, a post test loop can cause an exception that could crash your program. The pretest loop would be the easiest.





Hope this helps.

yu gi oh cards

No comments:

Post a Comment