在文本框text1中输入5个数,并用逗号隔开,点击command1按钮后,要求在该5个数字递增排列,并在label1中输
1个回答
展开全部
Private Sub Command1_Click()
Dim b() As String
Dim a(4) As Long
Dim temp As Long
b() = Split(Text1.Text, ",")
For i = 0 To 4
a(i) = b(i)
Next i
For m = 0 To 4
For i = m To 4
If a(m) > a(i) Then
temp = a(m)
a(m) = a(i)
a(i) = temp
End If
Next i
Next m
Label1.Caption = a(0) & "," & a(1) & "," & a(2) & "," & a(3) & "," & a(4)
End Sub
Dim b() As String
Dim a(4) As Long
Dim temp As Long
b() = Split(Text1.Text, ",")
For i = 0 To 4
a(i) = b(i)
Next i
For m = 0 To 4
For i = m To 4
If a(m) > a(i) Then
temp = a(m)
a(m) = a(i)
a(i) = temp
End If
Next i
Next m
Label1.Caption = a(0) & "," & a(1) & "," & a(2) & "," & a(3) & "," & a(4)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询