2007-04-18 09:53:44ㄉ一ㄜˊ先生

樂透有+特別號 程式

Private Sub Command1_Click()
Dim lotto(49) As Integer ’步驟一:宣告陣列

Dim i, j, no1, no2, temp As Integer ’變數宣告: i為迴圈控制變數

’no1,no2用來儲存步驟三中,隨機取出之兩元素的註標值
’temp用來作為步驟三中,兩元素質交換


Randomize
For i = 1 To 49
lotto(i) = i
Next i
For i = 1 To 1000
no1 = Int(Rnd * 49) + 1
no2 = Int(Rnd * 49) + 1
temp = lotto(no1)
lotto(no1) = lotto(no2)
lotto(no2) = temp
Next i

Text1.Text = lotto(1)
Text2.Text = lotto(2)
Text3.Text = lotto(3)
Text4.Text = lotto(4)
Text5.Text = lotto(5)
Text6.Text = lotto(6)
Text7.Text = lotto(7)



End Sub

Private Sub Command2_Click()
Text1.Text = ””
Text2.Text = ””
Text3.Text = ””
Text4.Text = ””
Text5.Text = ””
Text6.Text = ””
Text7.Text = ””

End Sub

Private Sub Command3_Click()
End
End Sub