【加試題】小李基于冒泡排序算法編寫了一個VB程序,功能如下:在文本框Text1中顯示排序前的數據,單擊“排序”按鈕Command1,在文本框Text2中顯示剔除重復數據后的升序排序結果。程序運行界面如圖所示。 實現上述功能的VB程序如下,但加框處代碼有錯,請改正。 Const n=10 Dim a(1To n) As Integer Private Sub Command1_Click ( ) Dim i As Integer,j As Integer,t As Integer Dim bottom As Integer '獲取排序前數據依次存儲在數組a中,并在文本框Text1中顯示。代碼略 bottom=n i=1 Do While i<=bottom-1 For j=bottom To i+1Step-1 If Then t=a(j):a(j)=a(j-1):a(j-1)=t ElseIf a(j)=a(j-1)Then'相鄰兩個數據相等,進行剔除處理 bottom=bottom-1 End If Next j i=i+1 Loop Text2.Text=““ For i=1To bottom Text2.Text=Text2.Text+Str(a(i)) Next i End Sub。