Ah. Its a simple error on our hand.
We forgot that floats cannot be compared directly
0.33333 = 0.33 will not return true always and even it does, change in the execution environmet(compiler, hardware, etc) will behave unpredictably.
try :
void diviGame(const double result, const double answer,
int & diviWins, int & diviLosses, int & diviTotal)
{
if (fabs(answer - result) < 0.01 ) //decide winning
diviWins++;
else //or loss
diviLosses++;
diviTotal++;
}
and see if it works now....
Also read this:
http://www.cygnus-software.com/paper...ringfloats.htm
Hope that solves the problem.
Cheers