dim name(1 to 64) as String
Dim b As Single
'这里你将64个人名字放到数组name里例如
name(1)="张三"
name(2)=“李四”
………………
'然后生成随机数
Randomize
b = Int(Rnd() * 64) + 1
Text1.Text = nane(b)
程序在下面,除去13号后总共点名39次,每次都不重复. 点完39次后可以复位又可以点名了。
Dim times, j As Integer
Dim num(1 To 40) As Integer
Private Sub Command1_Click()
start: Randomize
a = Int(Rnd * 40 + 1)
For i = 1 To 40
If a = num(i) Or a = 13 Then
GoTo start
End If
Next
Text1.Text = a
j = j + 1
num(j) = a
If j = 39 Then
MsgBox "所有人员均已点过!"
Command1.Enabled = False
Command2.Enabled = True
End If
End Sub
Private Sub Command2_Click()
j = 0
For i = 1 To 40
num(i) = 0
Next
Command2.Enabled = False
Command1.Enabled = True
Text1.Text = ""
End Sub
界面:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)