vb,产生10个两位随机整数,用冒泡排序法对10个数升序排列实验书上的填空 实验7-9
问题描述:
vb,产生10个两位随机整数,用冒泡排序法对10个数升序排列
实验书上的填空
实验7-9
答
Dim a(10) As Integer
Dim i%,j%,t%
Randomiz
For i = 1 To 10
a(i) = Int(Rnd * 90 + 10)
Print a(i);
Next
Print
For i = 1 To 9
For j = i + 1 To 10
If a(i) > a(j) Then
t = a(i)
a(i) = a(j)
a(j) = t
End If
Next
Next
For i = 1 To 10
Print a(i);
Next