简单小游戏VB程序

2020-10-28 游戏 95阅读
Private a As Long '用于计时
'timer的时间设为1000,事件写入 a = a + 1
Private Sub Timer1_Timer()
a = a + 1
End Sub
Private Sub Form_Load()
timer1.Enabled = 0
End Sub
Private Sub CommandButton1_Click()
a = Int(Rnd() * 100) '随机一个1~99的整数
timer1.Enabled = 1
Do
b = Val(InputBox("输入数字"))
If a = b Then
timer1.Enabled = 0
MsgBox "猜对了,你用了" & a & "秒"
Exit Do
ElseIf a > b Then
MsgBox "太小了"
Else
MsgBox "太大了"
End If
Loop
End Sub
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com