导读 您好,今天小编胡舒来为大家解答以上的问题。vb语言设计是什么?,vb语言程序设计是什么相信很多小伙伴还不知道,现在让我们一起来看看吧!1、...

您好,今天小编胡舒来为大家解答以上的问题。vb语言设计是什么?,vb语言程序设计是什么相信很多小伙伴还不知道,现在让我们一起来看看吧!

1、Option ExplicitPrivate Sub Command1_Click() Dim a As Integer Dim b As Integer Dim c As Integer Static r As Integer Static ct As Integer Static n As Integer If Command1.Caption = "开始" Or Command1.Caption = "下一题" Then a = Int(Rnd() * 90) + 10 b = Int(Rnd() * 90) + 10 c = Int(Rnd() * 4) Select Case c Case 0 Label2.Caption = a & " + " & b & " = ?" r = a + b Case 1 If a < b Then r = a a = b b = r End If Label2.Caption = a & " - " & b & " = ?" r = a - b Case 2 a = Int(Rnd() * 100) + 1 b = Int(Rnd() * 100) + 1 If a < b Then r = a a = b b = r End If r = a b If r = 0 Then r = 1 a = b * r a = r Label2.Caption = a & " * " & b & " = ?" r = a * b Case 3 a = Int(Rnd() * 100) + 1 b = Int(Rnd() * 100) + 1 If a < b Then r = a a = b b = r End If r = a b If r = 0 Then r = 1 a = b * r Label2.Caption = a & " / " & b & " = ?" r = a b End Select Command1.Caption = "提交答案" Label3.Caption = "" Text1.Text = "" Else If Text1.Text = "" Then MsgBox "请输入答案", vbCritical Exit Sub End If Label2.Caption = Left(Label2.Caption, Len(Label2.Caption) - 1) & Text1.Text n = n + 1 If Val(Text1.Text) = r Then Label3.Caption = "√" Label3.ForeColor = vbBlue ct = ct + 1 Else Label3.Caption = "×" & "(正确答案:" & r & ")" Label3.ForeColor = vbRed End If List1.AddItem Label2.Caption & Label3.Caption Command1.Caption = "下一题" Label1.Caption = "正确率" & Format(ct / n, "00.0%") End IfEnd SubPrivate Sub Form_Load() Command1.Caption = "开始" Label1.Caption = "正确率:0%" Label2.Caption = "点开始按钮答题" Label3.Caption = "" Text1.Text = "" Randomize TimerEnd Sub不明白的加百度HI给你发代码。

本文就为大家分享到这里,希望小伙伴们会喜欢。