作一个可供小学生数学运算的程序:10以内的加减乘除,能根据输入的题数计算机自动出题,并判断是否正确
对随机函数不太会用,还有如何控制计算机出题个数那里不太明白。。希望高手帮帮忙,写程序看看。可不可以用c语言编呢、、、...
对随机函数不太会用,还有如何控制计算机出题个数那里不太明白。。希望高手帮帮忙,写程序看看。
可不可以用c语言编呢、、、 展开
可不可以用c语言编呢、、、 展开
2个回答
展开全部
Qbasic:
Randomize Timer
INPUT "N="; N
For i = 1 To N
k = Int(Rnd * 4)
Select Case k
Case 0:
a = Int(Rnd * 11)
b = Int(Rnd * 11)
e$ = "+"
c = a + b
Case 1:
c = Int(Rnd * 11)
b = Int(Rnd * 11)
e$ = "-"
a = b + c
Case 2:
a = Int(Rnd * 10)
b = Int(Rnd * 10)
e$ = "*"
c = a * b
Case 3:
c = Int(Rnd * 10)
b = Int(Rnd * 9) + 1
e$ = "/"
a = b * c
End Select
Print a; e$; b; "=";
INPUT d
If c = d Then
Print "right!"
Else
Print "Wrong!"
End If
Next i
Randomize Timer
INPUT "N="; N
For i = 1 To N
k = Int(Rnd * 4)
Select Case k
Case 0:
a = Int(Rnd * 11)
b = Int(Rnd * 11)
e$ = "+"
c = a + b
Case 1:
c = Int(Rnd * 11)
b = Int(Rnd * 11)
e$ = "-"
a = b + c
Case 2:
a = Int(Rnd * 10)
b = Int(Rnd * 10)
e$ = "*"
c = a * b
Case 3:
c = Int(Rnd * 10)
b = Int(Rnd * 9) + 1
e$ = "/"
a = b * c
End Select
Print a; e$; b; "=";
INPUT d
If c = d Then
Print "right!"
Else
Print "Wrong!"
End If
Next i
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Qbasic:
Randomize Timer
INPUT "N="; N
For i = 1 To N
k = Int(Rnd * 4)
Select Case k
Case 0:
a = Int(Rnd * 11)
b = Int(Rnd * 11)
e$ = "+"
c = a + b
Case 1:
c = Int(Rnd * 11)
b = Int(Rnd * 11)
e$ = "-"
a = b + c
Case 2:
a = Int(Rnd * 10)
b = Int(Rnd * 10)
e$ = "*"
c = a * b
Case 3:
c = Int(Rnd * 10)
b = Int(Rnd * 9) + 1
e$ = "/"
a = b * c
End Select
Print a; e$; b; "=";
INPUT d
If c = d Then
Print "right!"
Else
Print "Wrong!"
End If
Next i
Randomize Timer
INPUT "N="; N
For i = 1 To N
k = Int(Rnd * 4)
Select Case k
Case 0:
a = Int(Rnd * 11)
b = Int(Rnd * 11)
e$ = "+"
c = a + b
Case 1:
c = Int(Rnd * 11)
b = Int(Rnd * 11)
e$ = "-"
a = b + c
Case 2:
a = Int(Rnd * 10)
b = Int(Rnd * 10)
e$ = "*"
c = a * b
Case 3:
c = Int(Rnd * 10)
b = Int(Rnd * 9) + 1
e$ = "/"
a = b * c
End Select
Print a; e$; b; "=";
INPUT d
If c = d Then
Print "right!"
Else
Print "Wrong!"
End If
Next i
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询