Public Class Form1
Dim cn(42)
Dim rn(42)
Dim aM
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i
ReDim cn(42)
For i = 1 To 42
cn(i) = i
Next
For i = 1 To 6
Dim s = Int(Rnd() * 42 + 1)
Dim t = cn(i)
cn(i) = cn(s)
cn(s) = t
Next
ReDim Preserve cn(6)
Array.Sort(cn)
TextBox1.Text = cn(1)
TextBox2.Text = cn(2)
TextBox3.Text = cn(3)
TextBox4.Text = cn(4)
TextBox5.Text = cn(5)
TextBox6.Text = cn(6)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i
ReDim rn(42)
For i = 1 To 42
rn(i) = i
Next
For i = 1 To 6
Dim s = Int(Rnd() * 42 + 1)
Dim t = rn(i)
rn(i) = rn(s)
rn(s) = t
Next
ReDim Preserve rn(6)
Array.Sort(rn)
TextBox7.Text = rn(1)
TextBox8.Text = rn(2)
TextBox9.Text = rn(3)
TextBox10.Text = rn(4)
TextBox11.Text = rn(5)
TextBox12.Text = rn(6)
'
Dim c = 0, j
Dim s1 = ""
For i = 1 To 6
For j = 1 To 6
If cn(i) = rn(j) Then
c = c + 1
s1 = s1 & cn(i) & ". "
End If
Next
Next
Label2.Text = "中" & c & "號"
Label1.Text = "中的號碼:" & s1
Dim m() = {0, 0, 0, 200, 2000, 20000, 2000000}
Label5.Text = "獎金:" & Format(m(c), "#,##0")
aM = aM - 50 + m(c)
label6.text = "累積輸贏: $" & Format(aM, "#,##0")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim i
For i = 1 To 100
Button1_Click(sender, e)
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
aM = 0
End Sub
End Class
沒有留言:
張貼留言