by Wizard » Sat Sep 27, 2003 7:53 am
You're only setting x and y once, right at the start.
Somewhere in the
if (ans==x*y){
block, set x and y to new random variables, as you did at the start. Don't call srand again, though.
Also, if I understand what you want, put the switch statements before asking the new question. What it currently does is, if you get it right, it then asks the same question again (which will be fixed with the new rand statements) and based on the answer to that SECOND question, it outputs the case. Also, you're only considering answers of 0, 1, and 2. If the numbers are, say, 2 and 3 which = 6, then the default will be shown.