四则运算测试:每次运行,只能做十道题,题目通过产生随机数组成的两位数的四则运算式组成,若是除法,四舍五入,保留小数点后两位
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 15:59:48
四则运算测试:每次运行,只能做十道题,题目通过产生随机数组成的两位数的四则运算式组成,若是除法,四舍五入,保留小数点后两位
四则运算测试:每次运行,只能做十道题,题目通过产生随机数组成的两位数的四则运算式组成,
若是除法,四舍五入,保留小数点后两位
四则运算测试:每次运行,只能做十道题,题目通过产生随机数组成的两位数的四则运算式组成,若是除法,四舍五入,保留小数点后两位
Private Sub Command1_Click()
Dim i As Integer,k As Integer,s As Long,s1 As Double
Dim a As Integer,b As Integer,ab As String
i = 0
Randomize
a = Int(Rnd() * 99) + 30
Randomize
b = Int(Rnd() * 99) + 30
Randomize
k = Int(Rnd() * 10) + 1
s = 0
s1 = 0
If i > 10 Then
MsgBox "Sorry,每次只能运算10题!"
Exit Sub
End If
If k < 3 Then
ab = "+"
s = a + b
Else
If k < 6 Then
ab = "-"
s = a - b
Else
If k < 9 Then
ab = "*"
s = a * b
Else
ab = "/"
s1 = a / b
s1 = Format(s1,"0.00")
End If
End If
End If
If ab = "/" Then
Label1.Caption = a & " " & ab & " " & b & " = " & s1
i = i + 1
Else
Label1.Caption = a & " " & ab & " " & b & " = " & s
i = i + 1
End If
End Sub
自己想
什么意思?