' 功能:以下程序段采用冒泡法对数组元素进行排序。 '------------------------------------------------------- Option Base 1 Private Sub Command1_Click() Dim iA(1 To 10) n = 6 iA(1) = 8: iA(2) = 6: iA(3) = 9: iA(4) = 3: iA(5) = 2: iA(6) = 7 Print " 冒泡法排序数据变化过程 " Print " 8, 6, 9, 3, 2, 7" Print "-----------------------------" '**********SPACE********** For i = 1 To 【 ? 】 Step 1 '**********SPACE********** For j = n To 【 ? 】 Step -1 If iA(j) < iA(j - 1) Then t = iA(j) iA(j) = iA(j - 1) '**********SPACE********** iA(j - 1) = 【 ? 】 End If Next j Print "i="; i; Spc(i * 3 - 3); For k = i To n Print iA(k); Next k Print Next i End Sub