哪位大神帮忙做一下这道程序题?
写一个随机抽奖的程序,抽出类似1111100011001011之类的组合只有1111为中奖...
写一个随机抽奖的程序,抽出类似
1111 1000 1100 1011之类的组合
只有1111为中奖 展开
1111 1000 1100 1011之类的组合
只有1111为中奖 展开
1个回答
展开全部
Dim n As Integer
Private Sub Command1_Click()
n = 1 - n
If n = 1 Then
Command1.Caption = "停"
Else
Command1.Caption = "开始"
End If
Timer1.Interval = 50 * n
If n = 0 And Text1 = "1111" Then MsgBox ("恭喜你!中奖了!!")
End Sub
Private Sub Form_Load()
Text1.FontSize = 20
Text1 = ""
Command1.Caption = "开始"
End Sub
Private Sub Timer1_Timer()
s = ""
Randomize
For i = 1 To 4
If Rnd >= 0.5 Then s = s & 1 Else s = s & 0
Next i
Text1 = s
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询