您的位置:首页 > 其它

比较3个数的大小

2016-03-31 17:33 239 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: