利用vb排列数字大小,求解答
追答
Private Sub Command1_Click()
s = "23,6,123,56,34,8,56,234,57"
Print "您输入的是:"
Print s
Dim a() As String, b() As Integer
a = Split(s, ",")
n = UBound(a)
ReDim b(n)
For i = 0 To n
b(i) = CInt(a(i))
Next i
For i = 0 To n - 1
For j = 0 To n - 1 - 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
Print "排序以后的数组:"
For i = 0 To n
Print b(i);
Next i
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询