比较3个数的大小

来源:互联网 发布:2016年韩国进出口数据 编辑:程序博客网 时间:2024/05/22 22:44

Private Sub Command1_Click()
Cls
Me.Font.Size = 24
Dim a As Integer
Dim b As Integer
Dim c As Integer

a = Int(Rnd * 1000)
b = Int(Rnd * 1000)
c = Int(Rnd * 1000)

If a < b Then
Call swap(a, b)
End If
If a < c Then
Call swap(a, c)
End If
If b < c Then
Call swap(b, c)
End If



Print a & "," & b & "," & c &"," & d
End Sub
Private Sub swap(x As Integer, y As Integer)
Dim temp As Integer
If x < y Then
temp = x
x = y
y = temp
End If
End Sub

0 0
原创粉丝点击