Dim n As Integer
Dim a(1 to 10)As Integer
Private Sub Form_Load( )
‘n=10,排序前生成的数据存储在数组a中,并在列表框List1中显示
‘代码略
End Sub
Private Sub Command1_Click( )
Dim i,j As Integer
Dim start As Integer
‘①
Do While i<n
start=n
For j=n To i Step-1
If a(j)<a(j-1)Then
t=a(j):a(j)=a(j-1):a(j-1)=t
start=j
End If
Next j
‘②
Loop
For i=1 To n
List2.AddItem Str(a(i))
Next i
End sub
以上程序段运行时,为了实现上述功能,加框处代码应改正为:①;②。