lap1:
If Len(n) <>7 Or Not IsNumeric(n) Then
MsgBox "请输入正蔽樱确兑奖号码"
GoTo lap1:
End If
s = "": ms = ""
k = 0: Max = 0
For i = 1 To 7
If Mid(Text1.Text, i, 1) = Mid(CStr(n), i, 1) Then
k = k + 1
s = s + Mid(CStr(n), i, 1)
If k >Max Then
Max = k
ms = s
End If
Else
s = ""
k = 0
End If
Next
If Max <2 Then st = "没有中奖"
If Max = 2 Then st = "中六等奖"
If Max = 3 Then st = "中五等奖宏穗丛"
If Max = 4 Then st = "中四等奖族李"
If Max = 5 Then st = "中三等奖"
If Max = 6 Then st = "中二等奖"
If Max = 7 Then st = "恭喜你中一等奖"
MsgBox st
End Sub
Private Sub Form_Load()
Randomize
Text1.Text = ""
For i = 1 To 7
Text1.Text = Text1.Text &Int(Rnd * 10) '产生七星彩中奖号码
Next
End Sub
Dim a(6) As Integer '声明数组Function JC(n As Integer) As Double
'求阶乘
JC = 1
For i = 1 To n
JC = JC * i
Next
End Function
Sub S36_7()
'选号
On Error Resume Next
For i = 0 To 6
Line1:
a(i) = Fix(Rnd * 36) + 1
For j = 0 To i - 1
If a(i) = a(j) Then
GoTo Line1
End If
Next
Next
End Sub
Sub PrintNum()
'输搜丛亏出
For i = 0 To 6
Print a(i)
Next
End Sub
Private Sub Command1_Click()
'世神调用
Call S36_7
Call PrintNum
End Sub
Private Sub Command2_Click()
'输出
Print "获奖概率"JC(36) /郑竖 JC(7) / JC(36 - 7)
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)