Private Sub Form_Click()
Dim n As Integer, m
Cls
Do Until n = 6
Randomize
n = Int(Rnd 6) + 1
Print "点数:"; n
m = m + 1
Loop
Print String(10, "") & vbNewLine & "次数:"; m
End Sub
Dim Big As Boolean
Private Sub Form_Load()
rollEnabled = False
playEnabled = True
gpbCaption = "请按Play掷骰子"
End Sub
Private Sub play_Click()
Dim x As Long, y As Long
Randomize
x = CInt(Rnd() 5 + 1)
y = CInt(Rnd() 5 + 1)
If x + y > 6 Then
Big = True
gpbCaption = "点数为大"
Else
Big = False
gpbCaption = "点数为小"
End If
playEnabled = False
rollEnabled = True
End Sub
Private Sub roll_Click()
Dim x As Long, y As Long
Randomize
x = CInt(Rnd() 5 + 1)
y = CInt(Rnd() 5 + 1)
If x + y > 6 Then
If Big = True Then
gpbCaption = "你赢了"
Else
gpbCaption = "你输了"
End If
Else
If Big = True Then
gpbCaption = "你输了"
Else
gpbCaption = "你赢了"
End If
End If
playEnabled = True
rollEnabled = False
End Sub
以上就是关于VB:连续掷骰子,显示每次投掷的结果,直至出现6点为止,显示已投掷的次数。全部的内容,包括:VB:连续掷骰子,显示每次投掷的结果,直至出现6点为止,显示已投掷的次数。、求助VB程序编写、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)