当前位置: > 四则运算测试:每次运行,只能做十道题,题目通过产生随机数组成的两位数的四则运算式组成,...
题目
四则运算测试:每次运行,只能做十道题,题目通过产生随机数组成的两位数的四则运算式组成,
若是除法,四舍五入,保留小数点后两位

提问时间:2021-02-28

答案
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
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.