| 网站首页 | 业界新闻 | 群组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 编程论坛

已结贴   问题点数：20  回复次数：4
VB/一段代码 求简便的方法。
Private Sub Form_Click()
Dim a As Integer, b As Integer, c As Integer
a = InputBox("输入")
b = InputBox("输入")
c = InputBox("输入")
If a > b And b > c Then
Print , a, b, c
ElseIf a > c And c > b Then
Print a, c, b
ElseIf b > a And a > c Then
Print b, a, c
ElseIf b > c And c > a Then
Print , b, c, a
ElseIf c > a And a > b Then
Print c, a, b
Else
Print c, b, a
End If
Print
End Sub

得分:10
Private Sub Form_Click()
Dim a As Integer, b As Integer, c As Integer
a = InputBox("输入")
b = InputBox("输入")
c = InputBox("输入")

prt a,b,c  '调用子过程
End Sub

Private Sub prt(byval s1 as Integer,byval s2 as integer,byval s3 as integer)
Dim m(0 To 2) As Integer
m(1) = s1
m(2) = s2
m(0) = s3
For s1 = 0 To 1
If m(s1) < m(s1 + 1) Then
s2 = m(s1)
m(s1) = m(s1 + 1)
m(s1 + 1) = s2
End If
Next
Print m(0), m(1), m(2)

end sub
得分:10

Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer
a = InputBox("输入")
b = InputBox("输入")
c = InputBox("输入")
Call bijiao(a, b)
Call bijiao(b, c)
Call bijiao(a, b)
Debug.Print a; b; c
End Sub

Function bijiao(a, b) As Integer '返回a大数，b小数
If a <= b Then
temp = a
a = b
b = temp
End If
End Function

[此贴子已经被作者于2017-11-26 08:15编辑过]

得分:0

得分:0

• 5
• 1/1页
• 1