Computer Science Canada how to make a random math question generator? |
Author: | upandatom [ Sun Jan 16, 2005 8:41 pm ] |
Post subject: | how to make a random math question generator? |
how to make a random math question generator? |
Author: | AsianSensation [ Sun Jan 16, 2005 8:47 pm ] |
Post subject: | |
by using the Rand module in turing and some ingenuity. |
Author: | susan_101 [ Sun Jan 16, 2005 8:49 pm ] |
Post subject: | |
hmm maybe rand.int(0,999)+rand.int(0,999)? but then how do yu record wat user put down and if its correct? |
Author: | Cervantes [ Sun Jan 16, 2005 8:52 pm ] |
Post subject: | |
susan_101 wrote: hmm maybe rand.int(0,999)+rand.int(0,999)? but then how do yu record wat user put down and if its correct?
Store information as variables. |
Author: | susan_101 [ Sun Jan 16, 2005 8:56 pm ] |
Post subject: | |
lol cervantes you again, im glad you are on this thingy ![]() |
Author: | susan_101 [ Sun Jan 16, 2005 9:03 pm ] |
Post subject: | |
but how would you make it ask different question every time you answer cervantes? var number1:real:=Rand.Int(0,99) var number2:real:=Rand.Int(0,99) var question:real:=Rand.Int(0,99) var reply:string var math_answer:real loop put"math question answer?" get reply if reply="yes" then put number1,"+",number2 get math_answer if math_answer=number1+number2 then put"you win" end if end if end loop |
Author: | TheXploder [ Sun Jan 16, 2005 9:39 pm ] | ||
Post subject: | |||
ok yeah, first of all you can make it int cause Rand.Int(0,99) will never give a real value thats what Rand.Real does. So something like this to make them random again...
|
Author: | Neo [ Sun Jan 16, 2005 9:39 pm ] | ||
Post subject: | |||
You generate the random number inside the loop like so:
|
Author: | susan_101 [ Sun Jan 16, 2005 9:42 pm ] |
Post subject: | |
so guys hwo would yu make a counter in that? say i wanted to ask as many questions as i wanted within 30 seconds? anyone know? |
Author: | susan_101 [ Sun Jan 16, 2005 9:50 pm ] |
Post subject: | |
teh counter could be for decreasing j : 10 .. 1 put j delay(1000) cls end for but then it erases after and it gets all screwd lol suggestions? |
Author: | susan_101 [ Sun Jan 16, 2005 10:15 pm ] |
Post subject: | |
![]() |
Author: | Bacchus [ Sun Jan 16, 2005 11:27 pm ] |
Post subject: | |
if you want a specific timer then: from start of program-> Time.Elapsed from a specific point-> Time.DelaySinceLast |
Author: | [Gandalf] [ Sun Jan 16, 2005 11:43 pm ] | ||
Post subject: | |||
Oops, I misread, I thought you said "30 times" not 30 seconds... Oh well, just in case - there you have it. |