bshy.net
当前位置:首页>>关于vb猜数字游戏编程 要求:让电脑猜一个0-100的数字...的资料>>

vb猜数字游戏编程 要求:让电脑猜一个0-100的数字...

Dim state As Integer '状态 0表示没开始 1表示已开始 Dim min As Integer '最小值 Dim max As Integer '最大值 Dim now As Integer '中值 Dim c As Integer '猜的次数 Private Sub Command1_Click() '开始 state = 1 Guess End Sub Private Sub...

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("猜对...

Option ExplicitPrivate Sub Command1_Click()On Error Resume NextDim I As IntegerI = MsgBox("下面游戏开始,你准备好了吗?", vbYesNo)If I = 6 Then Frame1.Visible = True: Text1 = "" Else Frame1.Visible = FalseText1.SetFocusRandomiz...

'两个文字列表框,一个文本框,两个按钮Dim k As BooleanPrivate Sub Command1_Click() '产生一个随机数 Text1 = "" Label1 = "" Label2 = "请在框中输入数字,按回车键猜数" k = False Do While k = False Label1 = Int(100 * Rnd()) '产生的随...

1、我仔细看了下,发现这段语句没什么用: If i = 5 Then Exit Sub End If 因为i=5时,for循环也结束了,所以有没有这段循环都会结束。所以这段代码可以删除了,当然不删也不影响,考虑到代码的质量的话,删去吧。 2、我估计你是想在这里加入一...

int(rnd()*9+1)

啥叫用菜单开始程序?是开始游戏哇?就跟蜘蛛纸牌扫雷一样哇?用户是把自己猜的数放在textbox里,还是inputbox?以上均为疑问句……

Dim a As ByteDim b As Byte '回车次数Private Sub Command1_Click()Randomizea = Int(Rnd * 100 + 1)Command1.Enabled = Falseb = 0End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)If KeyAscii = 13 And Command1.Enabled = False The...

n=int(rnd*(100)) val(text1.text)

Option Explicit Private Sub Command1_Click() Dim Tar%, Tmp%, C%, Rsp$ Randomize Tar = Int(Rnd * 100) + 1 Tmp = InputBox("猜猜是几?1~100 ", "Just Guess") C = C + 1 Do While Tmp Tar Select Case Tar - Tmp Case Is > 0 Rsp = "小了...

网站首页 | 网站地图
All rights reserved Powered by www.bshy.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com