Christopher said:
I've declared o to be a double and c an int. No matter what the value of c,
o is never greater than 0 after the following line of code:
o = (c / 100);
Any ideas why?
No idea IF your claim is correct. However, I think what you really mean is "No
matter what the value of c (as long as it's less than 100), o is never greater
than 0."
The expression (c / 100) is apparently calculated using integer arithmetic,
which is perfectly reasonable since c and 100 are both integer expressions. The
integer result of this division will be zero when c is less than 100. I suggest
you test your "no matter what" claim with some larger values of c (e.g., 100,
101, 199, 200, 201, 299, etc.) and watch what happens.
-rick-