Quantcast
Channel: if else issues
Viewing all articles
Browse latest Browse all 5

if else issues

$
0
0

On 2/27/2012 1:38 PM, techiegzz wrote:

I am having some isues with C++ if...else syntax and I can't seem to
figure it out as I am not getting the desired results even though I
feel that I have it all set. Here is my code;

What's the nature of the problem? What input are you giving to your program, what results do you observe, and how do said results differ from your expectation?

       taxesDue = grossIncome * (10 / 100);

Since both 10 and 100 are integers, the division is an integral division (truncated towards zero). Thus, (10/100) == 0 , which doesn't appear to be what you want. I suggest you just make it

taxesDue = grossIncome * 0.10;

and similarly everywhere else you have percentages.


Igor Tandetnik


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>