VB 代码不知道哪里错了
来源:百度知道 编辑:UC知道 时间:2024/06/11 04:38:59
Private Sub Command1_Click()
Dim a(1 To 6) As Integer
Dim b(1 To 4) As Integer
a(1) = 5: a(2) = 88: a(3) = 9
a(4) = 44: a(5) = 66: a(6) = 6
b(1) = 99: b(2) = 152: b(3) = 55: b(4) = 1100
For Each c In a
Print c; " ";
Next c
Print
For Each c In b
Print c; " ";
Next c
Print
Call order(a())
Call order(b())
Print "数组排序后"
For Each c In a
Print c; " ";
Next c
Print
For Each c In b
Print c; " ";
Next c
Print
End Sub
Public Sub order(x())
Dim s As Integer, e As Integer
Dim t As Integer
s = LBound(x)
e = UBound(x)
For i = s To e
For j = i To e - 1
If x(i) < x(j + 1) Then
t = x(i)
x(i) = x(j + 1)
x(j + 1) = t
End If
Next j
Next i
End Sub
Dim a(1 To 6) As Integer
Dim b(1 To 4) As Integer
a(1) = 5: a(2) = 88: a(3) = 9
a(4) = 44: a(5) = 66: a(6) = 6
b(1) = 99: b(2) = 152: b(3) = 55: b(4) = 1100
For Each c In a
Print c; " ";
Next c
For Each c In b
Print c; " ";
Next c
Call order(a())
Call order(b())
Print "数组排序后"
For Each c In a
Print c; " ";
Next c
For Each c In b
Print c; " ";
Next c
End Sub
Public Sub order(x())
Dim s As Integer, e As Integer
Dim t As Integer
s = LBound(x)
e = UBound(x)
For i = s To e
For j = i To e - 1
If x(i) < x(j + 1) Then
t = x(i)
x(i) = x(j + 1)
x(j + 1) = t
End If
Next j
Next i
End Sub
Dim a(6)
Dim b(4)
Public Function order(x()) As String
VB6.0 调试OK
Private Sub Command1_Click()
Public Function order(x()) As String
Dim a(6)
Dim b(4)
a(1) = 5: a(2) = 88: a(3) = 9
a(4) = 44: a(5) = 66: a(6) = 6
b(1) = 99: b(2) = 152: b(3) = 55: b(4) = 1100
For Each c In a
Print c; " ";
Next c
Print
For Each c In b
Print c; " ";
Next c
Print
Call order(a())
Call order(b())
Print "数组排序后"
For Each c In a
Print c; " ";
Next c
Print
For Each c In b
Print c; " ";
Next c
Print
End Sub
Public Sub order(x())
Dim s As Integer, e As Integer
Dim t As Integer
s = LBound(x)
e = UBound(x)
For i = s To e
For j = i To e - 1
If x(i) < x(j + 1) Then
t = x(i)
x(i) = x(j + 1)
x(j + 1) = t
End If
Next j
Next i