永发信息网

vb四则运算

答案:1  悬赏:80  手机版
解决时间 2021-08-14 00:16
两个窗口,第一个为数字和确定按钮,第二个是加减乘除级别的选择,除法要求是整除,第一个窗口打开后,默认为加法,一位数与一位数的运算
最佳答案
Dim a, b, i, j, h As Integer, c(1 To 4), d As StringPrivate Sub Command1_Click()a = Int(Rnd * 11)b = Int((Rnd * 10) + 1)c(1) = "+": c(2) = "-": c(3) = "*": c(4) = "/"j = Int((Rnd * 4) + 1)d = c(j)Label1.Caption = a & d & b & "=" & "?"Label1.RefreshCommand1.Enabled = FalseEnd SubPrivate Sub Command2_Click()i = i + 1If d = c(1) Then If Text1.Text = a + b Then MsgBox "恭喜你,计算正确" h = h + 1 Text1.Text = "" Command1.Enabled = True Label2.Caption = "共" & i & "道题," & "答对" & h & "道题。" Label2.Refresh Else MsgBox "真遗憾,计算错误" Text1.Text = "" Command1.Enabled = True Label2.Caption = "共" & i & "道题," & "答对" & h & "道题。" Label2.Refresh End IfElseIf d = c(2) Then If Text1.Text = a - b Then MsgBox "恭喜你,计算正确" h = h + 1 Text1.Text = "" Command1.Enabled = True Label2.Caption = "共" & i & "道题," & "答对" & h & "道题。" Label2.Refresh Else MsgBox "真遗憾,计算错误" Text1.Text = "" Command1.Enabled = True Label2.Caption = "共" & i & "道题," & "答对" & h & "道题。" Label2.Refresh End IfElseIf d = c(3) Then If Text1.Text = a * b Then MsgBox "恭喜你,计算正确" h = h + 1 Text1.Text = "" Command1.Enabled = True Label2.Caption = "共" & i & "道题," & "答对" & h & "道题。" Label2.Refresh Else MsgBox "真遗憾,计算错误" Text1.Text = "" Command1.Enabled = True Label2.Caption = "共" & i & "道题," & "答对" & h & "道题。" Label2.Refresh End IfElseIf d = c(4) Then If CDbl(Text1.Text) = a / b Then MsgBox "恭喜你,计算正确" h = h + 1 Text1.Text = "" Command1.Enabled = True Label2.Caption = "共" & i & "道题," & "答对" &
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
泡沫之夏的结局是
“圣经”这本书是谁出的
平望哪里有卖“娃娃雪糕”?
卑鄙的我经典语句,我欲封天王林出现苍茫的说
从佛山南海大沥到最近的海边怎么去?
华泰的学费8.5折?真的假的啊?
DNF谁能带我在烈焰格拉塔打出70以上操作?
dnf2及密码验证
钟祥市荆门钟祥市丰乐镇郝来酒坊在哪里啊,我
谁有关于采水果的图片啊,卡通的
武汉大学简介英文介绍,用英语介绍武汉大学的
问道的金刚星怎么加点好啊(全法的可以吗)
如何将Mp4用
对于执法部门的焚烧垃圾有什么合理的建议?
轻音少女NO,THANK YOU完整版MV!!在线地址。
推荐资讯
It looks as if it is going to rain.后面不
手机腾讯长微博怎么发,手机的新浪微博如何发
阿斗当官下一句,一鼓作气,再而衰下一句
在《元日》中有一句“千门万户瞳瞳日“”中“
相爱中的人一直一直的吵, 其中有个人不想吵
什么是事业者,
手机只能上QQ,而网页进不去,咋办?
N85在接电话中怎么屏幕的灯不会暗下来吗?而
怎么把QQ校内和QQ旋风的图标关闭
南宋诗人文天祥在过零丁洋中表现自己视死如归
大一计算机考试考什么,全国计算机一级考试怎
酒店去做会计好还是印染厂啊?
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?