该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
Option Base 1
Dim a#(10), b#, n#, i#, j#, m#, p#, t#
Private Sub Command1_Click()
n = LBound(a)
m = UBound(a)
For i = LBound(a) To UBound(a)
a(i) = Int(Rnd * (120 - 60 + 1) + 60)
Print a(i);
If i Mod 10 = 0 Then Print
Next i
End SubPrivate Sub Command2_Click()
n = LBound(a)
m = UBound(a)
For i = n To m
If a(n) > a(i) Then
a(n) = a(i)
End If
Next i
Print "最小值为:" & a(n)
End SubPrivate Sub Command3_Click()
n = LBound(a)
m = UBound(a)
For i = n To m - 1
p = i
For j = i + 1 To m
If a(p) > a(j) Then p = j
Next j
t = a(i): a(i) = a(p): a(p) = t
Next i
Print "选择排序后的数组为:"
For i = n To m
Print a(i);
If i Mod 10 = 0 Then Print
Next i
End SubPrivate Sub Command4_Click()
n = LBound(a)
m = UBound(a)
For i = n To m
For j = n To m - 1
If a(j) > a(j + 1) Then
t = a(j): a(j) = a(j + 1): a(j + 1) = t
End If
Next j
Next i
Print "冒泡排序后的数组为:"
For i = n To m
Print a(i);
If i Mod 10 = 0 Then Print
Next i
End SubPrivate Sub Command5_Click()
n = LBound(a)
m = UBound(a)
For i = n To 5
t = a(i): a(i) = a(11 - i): a(11 - i) = t
Next i
Print:
For i = n To m
Print a(i);
If i Mod 10 = 0 Then Print
Next i
End SubPrivate Sub Form_Load()End Sub
.qmbox style,.qmbox script,.qmbox head,.qmbox link,.qmbox meta{display: none !important;}