Sunday, August 2, 2009

What are the commands to make randomized math Q&A problems using microsoft visual basic?

I am making a game which consists of 5 problems(1+1=?, 5 x 6=?) and 3 choices(a.3 b.78 c.80) but I dont know how to randomize the questions and choices...pls help

What are the commands to make randomized math Q%26amp;A problems using microsoft visual basic?
You have to place the questions and answers in arrays.





Dim questions(10) as string


Dim answers(10) as string





questions(1) = "1+1"


answers(1) ="2"





questions(2) = "3x7"


answers(2) ="21"





Next you need to use a procedure:





Public PickQuestion()





x=int(10*rnd(1)): if x%26lt;1 then x=1





Label1.caption=questions(x)





For the command button when it is clicked the procedure code would be:





if text1.txt = answers(x) then msgbox("correct")

flamingo plant

No comments:

Post a Comment