數字抽獎源碼
發布時間: 2025-01-07 00:16:23
A. 求用VB編的一個抽獎系統,有源代碼的,最好有解釋。從49個人中抽
Dim p1 As Integer, p2 As Integer, p3 As Integer
'產生一等獎號碼
p1 = Rnd * 48 + 0.5 + 1
'產生二等獎號碼
Do
p2 = Rnd * 48 + 0.5 + 1
Loop Until p2 <> p1
'產生三等獎號碼
Do
p3 = Rnd * 48 + 0.5 + 1
Loop Until p3 <> p1 And p3 <> p2
MsgBox "一等獎:" & p1 & vbCrLf & _
"二等獎:" & p2 & vbCrLf & _
"三等獎:" & p3 & vbCrLf, vbInformation
熱點內容