高手帮忙,给下面程序提建议,任何建议,只要是你觉得能改善的(给我所有分)
Dim money As Integer
Dim s1, s2 As Integer
Dim q1, q2, q3, q4, q11, q22, q33, q44 As Integer
Dim i, n, m, j As Integer
Dim i2 As Integer
Dim i3 As Integer
Dim num(0 To 8) As Integer
Dim c, t As Integer
Private Sub Command1_Click()
Randomize
s1 = Text11.Text
s2 = CInt(Text12.Text)
money = Combo1.ListIndex + 6
q1 = Combo2.ListIndex
q2 = Combo3.ListIndex
q3 = Combo4.ListIndex
If q1 < 0 Then q1 = 2
If q2 < 0 Then q2 = 1
If q3 < 0 Then q3 = 1
q4 = Int(6 - q1 - q2 - q3)
Text13.Text = q4
Call shengcheng
End Sub
Sub shengcheng()
i = 0
For i = 1 To 8
num(i) = Int(33 * Rnd + 1)
Next i
num(0) = Int(16 * Rnd + 1)
For i = 1 To 8
n = 0
For j = 1 To 8
If num(i) = num(j) Then n = n + 1
If n > 1 Then num(j) = Int(33 * Rnd + 1)
Next j
Next i
If num(1) + num(2) + num(3) + num(4) + num(5) + num(6) < s1 Then Call shengcheng
If num(1) + num(2) + num(3) + num(4) + num(5) + num(6) > s2 Then Call shengcheng
q11 = 0
q22 = 0
q33 = 0
q44 = 0
For i = 1 To 6
If num(i) < 9 Then q11 = q11 + 1
If num(i) > 8 And num(i) <= 16 Then q22 = q22 + 1
If num(i) > 16 And num(i) <= 24 Then q33 = q33 + 1
If num(i) > 24 Then q44 = q44 + 1
Next
If q11 <> q1 Then Call shengcheng1
If q22 <> q2 Then Call shengcheng2
If q33 <> q3 Then Call shengcheng3
Text1.Text = num(1)
Text2.Text = num(2)
Text3.Text = num(3)
Text4.Text = num(4)
Text5.Text = num(5)
Text6.Text = num(6)
If money = 7 Then
Text7.Text = num(7)
Else
Text7.Text = ""
Text8.Text = ""
End If
If money = 8 Then
Text7.Text = num(7)
Text8.Text = num(8)
Else
Text8.Text = ""
End If
Text9.Text = num(0)
End Sub
Sub shengcheng1()
If q11 > q1 Then
i = 1
While num(i) > 8
i = i + 1
Wend
num(i) = Int(33 * Rnd + 1)
Call shengcheng11
If num(i) > 8 Then q11 = q11 - 1
Call shengcheng1
ElseIf q11 < q1 Then
i = 1
While num(i) < 8
i = i + 1
Wend
num(i) = Int(33 * Rnd + 1)
Call shengcheng11
If num(i) < 8 Then q11 = q11 + 1
Call shengcheng1
End If
End Sub
Sub shengcheng2()
On Error GoTo ww1
ww1:
If i2 > 8 Then
i2 = 1
num(i2) = Int(7 * Rnd + 17)
End If
If q22 > q2 Then
i2 = 1
While num(i2) > 16 Or num(i2) < 9
i2 = i2 + 1
Wend
num(i2) = Int(7 * Rnd + 17)
Call shengcheng22
If num(i2) > 16 Then q22 = q22 - 1
Call shengcheng2
ElseIf q22 < q2 Then
i2 = 1
While num(i2) < 17
i2 = i2 + 1
Wend
num(i2) = Int(7 * Rnd + 9)
Call shengcheng23
If num(i2) < 17 And num(i2) > 8 Then q22 = q22 + 1
Call shengcheng2
End If
End Sub
Sub shengcheng3()
On Error GoTo ww
If q33 > q3 Then
i3 = 1
ww:
If i3 > 8 Then
i3 = 1
End If
While num(i3) > 24 Or num(i3) < 17
i3 = i3 + 1
Wend
num(i3) = Int(8 * Rnd + 25)
Call shengcheng31
If num(i3) > 24 Then q33 = q33 - 1
Call shengcheng3
ElseIf q33 < q3 Then
i3 = 1
While num(i3) < 25
i3 = i3 + 1
Wend
num(i3) = Int(7 * Rnd + 17)
Call shengcheng32
If num(i3) < 25 And num(i3) > 16 Then q33 = q33 + 1
Call shengcheng3
End If
End Sub
Sub shengcheng11()
c = 0
For m = 1 To 8
If num(i) = num(m) Then c = c + 1
Next m
If c > 1 Then
num(i) = Int(33 * Rnd + 1)
Call shengcheng11
End If
End Sub
Sub shengcheng22()
c = 0
For m = 1 To 8
If num(i2) = num(m) Then c = c + 1
Next m
If c > 1 Then
num(i2) = Int(7 * Rnd + 17)
Call shengcheng22
End If
End Sub
Sub shengcheng23()
c = 0
For m = 1 To 8
If num(i2) = num(m) Then c = c + 1
Next m
If c > 1 Then
num(i2) = Int(7 * Rnd + 9)
Call shengcheng23
End If
End Sub
Sub shengcheng31()
c = 0
For m = 1 To 8
If num(i3) = num(m) Then c = c + 1
Next m
If c > 1 Then
num(i3) = Int(8 * Rnd + 25)
Call shengcheng31
End If
End Sub
Sub shengcheng32()
c = 0
For m = 1 To 8
If num(i3) = num(m) Then c = c + 1
Next m
If c > 1 Then
num(i3) = Int(7 * Rnd + 17)
Call shengcheng32
End If
End Sub
Private Sub Form_Load()
q1 = 2
q2 = 1
q3 = 1
money = 6
s1 = 60
s2 = 160
Call shengcheng
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
--------------------编程问答-------------------- 声明,我是一菜鸟,刚接触
这段程序实现的是双色球选号功能
望各位大虾不啬赐教
谢谢 --------------------编程问答-------------------- 不玩易做图 不如你说下规则 --------------------编程问答-------------------- 没有功能说明,不想提。。。 --------------------编程问答-------------------- 变量命名不要用q1, q2, q3, q4, q11, q22, q33, q44
过程和函数用英文,用拼音反而得花时间猜 --------------------编程问答-------------------- 谢谢,还有其他问题么? --------------------编程问答--------------------
随机选取小于33的红球,小于16的红球
功能:
可选复式,6+1 7+1 8+1
可要求和值
可控制区间比 1~8 9~16 17~24 25~33
不能重复,要满足功能,不然重新生成 --------------------编程问答-------------------- 另外加些兰球可以固定,现在外面投注的不能实现蓝球固定,红球随机觉得相当麻烦
另外可以提供界面输入奇偶数比,总和值,冷号热号等一些分析参数,这几个才生成号后判断一下就完了.
最好把双色球录入成数据库,那样能做更多的分析来生成号,不过我自己写的程序还没中过~~~~
--------------------编程问答-------------------- 好................................长 --------------------编程问答-------------------- 看着头晕................ --------------------编程问答-------------------- num(i) = Int(33 * Rnd + 1)
这是不是会造成号码中有相同的号,应该有个比较各个号码的子程序
补充:VB , 基础类