高校等考试题天天练二级VB]10月30日
分类: 计算机
时间: 2019-01-18 11:17:42
作者: 全国等级考试资料网
知识点:冒泡排序
下面事件过程产生10个两位的正的随机整数,并利用冒泡法升序排序,请完善它。
Private Sub Command1_Click()
Dim a(10) As Integer
For m = 1 To 10
a(m) = [ (1) ]
Next m
For m = 1 To 9
For n = [ (2) ] To 10
If a(m) [ (3) ] a(n) Then t = a(m): a(m) = a(n): a(n) = t
Next n
Next m
For m = 1 To 10
Print a(m);
Next m
End Sub
下面事件过程产生10个两位的正的随机整数,并利用冒泡法升序排序,请完善它。
Private Sub Command1_Click()
Dim a(10) As Integer
For m = 1 To 10
a(m) = [ (1) ]
Next m
For m = 1 To 9
For n = [ (2) ] To 10
If a(m) [ (3) ] a(n) Then t = a(m): a(m) = a(n): a(n) = t
Next n
Next m
For m = 1 To 10
Print a(m);
Next m
End Sub