数字抽奖源码
发布时间: 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
热点内容