求一道VB题。100以内的算术练习题(加减乘除)

点击“出题”,新的练习题在text1中出现
在text2中写入答案,按回车键显示在列表框中,并且对的打√,错的打×
窗体最上方有“欢迎使用算术练习题”的滚动字幕

感觉那个有点麻烦,我是做了一个,不过我刚学VB做的可能不好 ,加我QQ我传给你。765110505 

Dim a, b, he, cha, ji, chu, daan As Integer

Private Sub Command1_Click()

Label2.Caption = ""

Text2.Text = ""

Dim gailv As Single

    gailv = Rnd

    If gailv >= 0.75 Then

       Timerhe.Enabled = True

       Exit Sub

    ElseIf gailv >= 0.5 Then

       Timerhe.Enabled = True

       Exit Sub

    ElseIf gailv >= 0.25 Then

       Timerji.Enabled = True

       Exit Sub

    ElseIf gailv >= 0 Then

       Timerchu.Enabled = True

       Exit Sub

    End If

    

    

       

End Sub

Private Sub Command2_Click()

If Val(Text2.Text) = daan Then

   Label2.Caption = "√"

Else

   Label2.Caption = "×"

End If

End Sub

Private Sub Form_Load()

Timerhe.Enabled = False

Timerhe.Interval = 50

Timerchu.Enabled = False

Timerchu.Interval = 50

Timerji.Enabled = False

Timerji.Interval = 50

Timercha.Enabled = False

Timercha.Interval = 50

End Sub

Private Sub Timerchu_Timer()

a = Int(100 * Rnd)

b = Int(100 * Rnd)

If b <> 0 Then

    If a Mod b = 0 Then

        If a > b Then

           chu = a / b

           

           Text1.Text = a & "÷" & Str(b) & "="

           daan = chu

            Timerchu.Enabled = False

         End If

     End If

End If

        

   

   

End Sub

Private Sub Timercha_Timer()

a = Int(100 * Rnd)

b = Int(100 * Rnd)

cha = a - b

If cha >= 0 Then

   Text1.Text = a & "-" & b & "="

   daan = cha

   Timer1.Enabled = False

End If

End Sub

Private Sub Timerhe_Timer()

a = Int(100 * Rnd)

b = Int(100 * Rnd)

he = a + b

If he <= 100 Then

   Text1.Text = a & "+" & b & " ="

   daan = he

   Timerhe.Enabled = False

End If

End Sub

Private Sub Timerji_Timer()

a = Int(100 * Rnd)

b = Int(100 * Rnd)

ji = a * b

If ji <= 100 Then

        Text1.Text = a & "÷" & "b" & "="

        daan = ji

        Timerji.Enabled = False

End If

End Sub

温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-11-29
Dim sum As Single
Private Sub Command1_Click()
Randomize
x = Int((101) * Rnd)
y = Int((101) * Rnd)
Select Case Int((4) * Rnd + 1)
Case 1
Text1.Text = x & "+" & y
sum = x + y
Case 2
Text1.Text = x & "-" & y
sum = x - y
Case 3
Text1.Text = x & "*" & y
sum = x * y
Case 4
Text1.Text = x & "/" & y
sum = x / y
End Select
End Sub

Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 100
Label1.Caption = "欢迎使用算术练习题"
Label1.AutoSize = True
Label1.Move 0, 0
Command1.Caption = "出题"
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If sum = Val(Text2.Text) Then
List1.AddItem Text1.Text & "=" & Text2.Text & " √"
Else
List1.AddItem Text1.Text & "=" & Text2.Text & " X"
End If
End If
End Sub

Private Sub Timer1_Timer()
Label1.Left = Label1.Left + 20
If Label1.Left + Label1.Width >= Me.ScaleWidth Then Label1.Left = 0
End Sub本回答被提问者采纳

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网