Really simple function to calc scores doesn't work
Aug 29, 2010 at 6:25pm UTC
I made this very simple function to calculate the points each team had gotten after the user inputted the scores. However when I let him show the points it says something like 20094112654.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
if (teams[ploeg1].score < teams[ploeg2].score)
teams[ploeg2].punten += 3;
else if (teams[ploeg1].score > teams[ploeg2].score)
teams[ploeg1].punten += 3;
else if (teams[ploeg1].score == teams[ploeg2].score)
{
teams[ploeg2].punten += 1;
teams[ploeg1].punten += 1;
}
if (teams[ploeg3].score < teams[ploeg4].score)
teams[ploeg4].punten += 3;
else if (teams[ploeg3].score > teams[ploeg4].score)
teams[ploeg3].punten += 3;
else if (teams[ploeg3].score == teams[ploeg4].score)
{
teams[ploeg3].punten += 1;
teams[ploeg4].punten += 1;
}
Aug 29, 2010 at 6:57pm UTC
Are you sure that every element of teams has been initialised to 0?
Aug 29, 2010 at 6:57pm UTC
Oh, so stupid of me :S
Thanks hamster!
Topic archived. No new replies allowed.