I'm writing a program which tests a student on math. The problem is, whenever it asks a division question, the correct answer is rounded, which is a behavior I don't want. How do I stop this?
student_name$=Input$("Hi! What is your name? ")
Print "Hello "+student_name+"!"
Print "Please wait..."
SeedRnd MilliSecs()
Delay (Rand(1000,10000))
Print "Okay "+student_name+", now we will begin testing."
Print "I'm going to test you on using rational numbers."
x=Input("How many questions? ")
For t=0 To x
num_a=Rand(1,100)
num_b=Rand(1,100)
operator=Rand(1,4)
Select operator
Case 1
op$="+"
corans#=num_a+num_b
Case 2
op$="-"
corans#=num_a-num_b
Case 3
op$="*"
corans#=num_a*num_b
Case 4
op$="/"
corans#=num_a/num_b
End Select
ans=Input("What is "+num_a+""+op$+""+num_b+" ?")
If ans=corans# Then
Print corans#+" is correct!"
answers_correct=answers_correct+1
Else
Print "Incorrect. The answer is "+corans#
answers_incorrect=answers_incorrect+1
EndIf
Next
Print "Out of "+t+" questions, you got "+answers_correct+" questions correct, and "+answers_incorrect+" questions incorrect."
score#=answers_correct/t
Print "Therefore, your score is "+score#+"."
WaitKey
End
|