Dim x, y As Integer
Private Sub exit_Click()
End
End Sub
Private Sub Command1_Click()
If password.Text = "1234" Then
'产生两个加数
Randomize Timer
x = CInt(Rnd * 100)
y = CInt(Rnd * 100)
add1.Caption = x
add2.Caption = y
Else
MsgBox "对不起,密码有误!", 1, "提醒"
End If
End Sub
Private Sub Command2_Click()
If char.Caption = "+" Then
result.Text = Val(add1.Caption) + Val(add2.Caption)
End If
If char.Caption = "-" Then
result.Text = Val(add1.Caption) - Val(add2.Caption)
End If
If char.Caption = "*" Then
result.Text = Val(add1.Caption) * Val(add2.Caption)
End If
If char.Caption = "/" Then
result.Text = Val(add1.Caption) / Val(add2.Caption)
End If
End Sub
Private Sub Option1_Click()
char.Caption = Option1.Caption
End Sub
Private Sub Option2_Click()
char.Caption = Option2.Caption
End Sub
Private Sub Option3_Click()
char.Caption = Option3.Caption
End Sub
Private Sub Option4_Click()
char.Caption = Option4.Caption
End Sub
|