看了你程序,感到很糟.
注释都不写就好意思拿出来了?
注释都不写就好意思拿出来了?
Dim rom As Integer
Dim num As Integer
Dim time As Integer
Private Sub Command1_Click()
time = 0
rom = Int(Rnd * 100 + 1)
Command1.Enabled = False
Command2.Enabled = True
Text1.Enabled = True
End Sub
Private Sub Command2_Click()
num = Int(Val(Text1.Text))
If time < 10 Then
If num > rom Then Label1.Caption = "你猜的大于了。"
If num < rom Then Label1.Caption = "你猜的小于了。"
If num = rom Then Label1.Caption = "你猜对了。"
Else
Label1.Caption = "猪啊,10次都猜不对!"
Text1.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
End If
time = time + 1
End Sub
Private Sub Form_Load()
Label1.Caption = "显示情况"
Text1.Text = ""
Form1.Caption = "猜数游戏"
Command1.Caption = "出题"
Command2.Caption = "猜一猜"
rom = 0
Text1.Enabled = False
Command2.Enabled = False
End Sub
这个可以用.