VB编程(结构化程序与数组)第4题~~~求大神
Private Sub Command1_Click()
Dim i As Integer, j As Integer, tmp As Integer
For i = 1 To 15
For j = 1 To 15 - i
If a(j) < a(j + 1) Then
tmp = a(j)
a(j) = a(j + 1)
a(j + 1) = tmp
End If
Next j, i
Print "排序后的数组为:";
For i = 1 To 15
Print a(i) & " ";
Next
End Sub
Private Sub Form_Load()
Dim i As Integer
Me.AutoRedraw = True
Print "排序前的数组为";
For i = 1 To 15
Randomize
a(i) = Rnd * 89 + 10
Print a(i) & " ";
Next
End Sub
Private Sub Command1_Click()
Dim y As String, z As String
Dim arr(1 To 15)
Dim i As Integer, j As Integer, T As Integer
For i = 1 To 15
arr(i) = Int(Rnd * 90 + 10)
y = y & " " & arr(i)
Next
Print "排序前的数组为:" & y
For i = 1 To 14
For j = i + 1 To 15
If arr(i) < arr(j) Then
T = arr(i)
arr(i) = arr(j)
arr(j) = T
End If
Next
z = z & " " & arr(i)
Next
z = z & " " & arr(15)
Print "从大到小排序的数组为:" & z
End Sub
我错了木有看到你的,对不起啊!幸苦你了TAT