急求一道简单的VB排序题SOS

来源:百度知道 编辑:UC知道 时间:2024/05/09 08:21:37
键盘输入三个整数,放到变量A、B、C 中,将三个整数从小到大给予输出。

请给出全部代码,万分感谢!
方法简单点

怎么呢,
我给个吧

Sub aa()
a = CInt(InputBox("输入整数:"))
b = CInt(InputBox("输入整数:"))
c = CInt(InputBox("输入整数:"))
'用if麻烦,用冒泡法
Dim n(3), m
n(0) = a
n(1) = b
n(2) = c

For i = 0 To 2
For j = i + 1 To 2
If n(j) < n(i) Then m = n(i): n(i) = n(j): n(j) = m '交换
Next
Next

MsgBox "小-->大:" + CStr(n(0)) + ":" + CStr(n(1)) + ":" + CStr(n(2))
End Sub

a = CInt(InputBox("输入整数:"))
b = CInt(InputBox("输入整数:"))
c = CInt(InputBox("输入整数:"))

If A>B Then
If B>C Then
Print C,B,A
Else
If A>C Then
Print B,C,A
Else
Print B,A,C
End If
End IF
Else
If B<C Then
Print A,B,C
Else
If A<C Then
Print A,C,B
Else
Print C,A,B
End If
En