Sometimes an if statement is executed even if the condition isn't met. The condition involves a double value:
if (percentage < 10.0) cout << " ";
I use this line of code in my program and running it should output something like this:
Frequency of outcomes:
Outcome 1: 10.08 %
Outcome 2: 10.15 %
Outcome 3: 9.98 %
Outcome 4: 10.00 %
Outcome 5: 9.88 %
But this happens instead:
Frequency of outcomes:
Outcome 1: 10.08 %
Outcome 2: 10.15 %
Outcome 3: 9.98 %
Outcome 4: 10.00 %
Outcome 5: 9.88 %
As you can see, even though 10.00 is not less than 10.00, the if statement executes anyway. Why does this happen?
This is my code: http://codepad.org/Ikt85kZc