[填空题] 下面程序是用冒泡法将数组a中的10个整数按升序排列,请将程序补充完整。 Private Sub Command1_Click( ) Dim a, Tmp As Integer a

18 查阅

[填空题] 下面程序是用冒泡法将数组a中的10个整数按升序排列,请将程序补充完整。

Private Sub Command1_Click( )

Dim a, Tmp As Integer

a = Array (678,45,324,528,439,387,87,875,273,823)

For i = 【12】

Forj =0 To 9

Ifa (i)<a(j) Then

Tmp = a(i): a(i) = a(j) i a(j) = Tmp

End If

Next j,i

For i = 0 To 9

Print a(i)

Next

End Sub

参考答案:

0 To 9

使用Array函数给数组赋值时,默认数组的下标从0开始,依次比较各数大小,则i=0 To 9。

计算机考试