实现上述功能的VB代码如下,请回答下列问题:
Const n= 10
Dim a(1 To n) As Integer
Private Sub Form_ load( )
'数组初始化,生成1~20之间的随机整数并赋值给数组a,代码略
End Sub
Private Sub Cmd1_Click()
Dim i As Integer, j As Integer, t As Integer
Dim bottom As Integer
bottom= n
For i=1 To bottom-1
For j= bottom To i+1 Step -1
If Then '①改错
t=a(j) : a(j)=a(i) : a(i)=t
ElselIf a(j)=a(i) Then
'②填空
bottom= bottom- 1
End If
Next j
Next i
Text2. Text=" "
For i=1 To bottom
Text2. Text= Text2. Text+Str(a(i))
Next i
End Sub