实现上述功能的VB程序代码如下,请回答以下问题:
Const n = 50
Dim a(1 To n) As Integer
Dim f(n + 1 To 2 * n) As Boolean
Private Sub Command1_Click()
Dim i As Integer, j As Integer
Randomize
For i = n + 1 To 2 * n
f(i) = False
Next i
For j = 1 To n
a(j) = Int(Rnd * n) + n + 1
If f(a(j)) = True Then j = j - 1 Else ①
Next j
For i = 1 To n
List1.AddItem CStr(i) + "号-" + CStr(a(i)) 'cstr 把数值类型转换为字符串类型,并去前导空格
Next i
End Sub
Private Sub Command2_Click()
Dim i As Integer, j As Integer, m1 As Integer, m2 As Integer
m1 = 0: m2 = n \ 2
For i = n + 1 To 2 * n
If ② Then
m1 = m1 + 1: a(m1) = i
Else
m2 = m2 + 1: a(m2) = i
End If
Next i
For j = 1 To n \ 2
List2.AddItem "第" + CStr(2 * j - 1) + "名" + Str( ③ ) List2.AddItem "第" + CStr(2 * j) + "名" + Str(a(n \ 2 + j))
Next j
End Sub
① ② ③