用VB实现,编写一个100以内,可以自动出题的加法练习程序。(100以内的随机整数为INT(RND()*100))
第1个回答 推荐于2016-06-14
Private Sub Command1_Click()
Dim a, b As Integer
Dim s As String
Randomize
a = Int(Rnd() * 100)
b = Int(Rnd() * 100)
s = CStr(a)
Label1.Caption = s
s = CStr(b)
Label2.Caption = s
End Sub
Private Sub Command2_Click()
Dim a, b, c As Integer
a = CInt(Label1.Caption)
b = CInt(Label2.Caption)
c = CInt(Text1.Text)
If (a + b = c) Then
Command2.Caption = "正确"
Else
Command2.Caption = "错误"
End If
End Sub
Private Sub Form_Load()
Label1.Caption = ""
Label2.Caption = ""
Text1.Text = ""
End Sub本回答被提问者采纳
Dim a, b As Integer
Dim s As String
Randomize
a = Int(Rnd() * 100)
b = Int(Rnd() * 100)
s = CStr(a)
Label1.Caption = s
s = CStr(b)
Label2.Caption = s
End Sub
Private Sub Command2_Click()
Dim a, b, c As Integer
a = CInt(Label1.Caption)
b = CInt(Label2.Caption)
c = CInt(Text1.Text)
If (a + b = c) Then
Command2.Caption = "正确"
Else
Command2.Caption = "错误"
End If
End Sub
Private Sub Form_Load()
Label1.Caption = ""
Label2.Caption = ""
Text1.Text = ""
End Sub本回答被提问者采纳