VB: 1.输入3个数 输出其中最大的数? 2.设计2个变量交换值的程序

来源:百度知道 编辑:UC知道 时间:2024/09/20 08:52:56
用VB语言编写,谢谢 急用啊!

Private Function dd(a As Integer, b As Integer, c As Integer) As Integer
If a > b And a > c Then '除去 a最大的情况就是 b c 比较大小
dd = a
ElseIf b > c Then
dd = b
ElseIf c > b Then
dd = c
Elseif 3个情况都不符合 那就是相等了
dd = b
End If
End Function
Private Sub Command1_Click()
k = dd(22, 2, 3)
Print k
End Sub
=============================================
dim a,b,temp
交换变量
temp=a
a=b
b=temp
交换完成