这道VB代码怎么写?
这个程序是并不难的。已经作过相关题目的解答了的。
Dim a(40) As Integer
Private Sub Command2_Click()
Dim b(40) As Integer
Print "冒泡排序法排序后:"
For i = 1 To 40
b(i) = a(i)
Next i
For i = 1 To 39
For j = 1 To 40 - i
If b(j) > b(j + 1) Then
t = b(j): b(j) = b(j + 1): b(j + 1) = t
End If
Next j
Next i
For i = 1 To 40
Print b(i);
If i Mod 8 = 0 Then Print
Next i
End Sub
Private Sub Command1_Click()
Dim c(40) As Integer
Print "选择泡排序法排序后:"
For i = 1 To 40
c(i) = a(i)
Next i
For i = 1 To 39
k = i
For j = i + 1 To 40
If c(j) > c(k) Then k = j
Next j
t = c(i): c(i) = c(k): c(k) = t
Next i
For i = 1 To 40
Print c(i);
If i Mod 8 = 0 Then Print
Next i
End Sub
Private Sub Form_Click()
Print "初始数据为:"
For i = 1 To 40
a(i) = Rnd * 90 + 10
Print a(i);
If i Mod 8 = 0 Then Print
Next i
End Sub