2009-09-16, 09:30 AM
Russt Wrote:Shouldn't it be (rand() % (upperBound - lowerBound + 1))?
In that case the only way there'd be a division by 0 is if upperBound < lowerBound, which is tested against.
And it asks for an upperBound and lowerBound, then displays the instructions (what 1, 2, and 3 mean), then displays a guess before asking a number.
lowerBound = 25
upperBound = 75
rand() % (75 - 25 + 1)
rand() % (51)
So it will generate a number between 0 and 50 - not really what you want.
