Hey guys my name is Coty i am a brand new programmer taking a c++ class in college and i am having a problem with this lab not putting out a 0% when i input 0's in for the variables. I tried to talk to a programmer friend about it but his explanation wasn't great since he couldn't see the program or anything while we were at work. If you guys could suggest anything that would be great.
The check my teacher wants us to runs is 150 then 6 and you should get out 54 and 36%.But when i check with 0's i get a o and -1%
One of the problems you will have if all your inputs are zero is divide by zero errors resulting in a program crash (exception). Perhaps you should think about insuring your entries are greater than zero.
You could also put a condition on the calculation if you need to allow zeroes to be entered. If the denominator is 0, don't do the calculation which would result in error, but set fatPercent to 0.