Dim a As Integer
a = Int(Rnd() * 100)
Dim n As Integer
n = 0
Dim m As Integer
m = 1
TextBox1.Text = a
Do
n = InputBox("第" & m & "次了,请猜")
If n > a Then
MsgBox("太大了")
ElseIf n < a Then
MsgBox("太小了")
Else
MsgBox("猜对了")
End If
m = m + 1
If m > 10 Then
MsgBox("没猜对")
Exit Do
End If
Loop Until a = n