在VB中:编写一个函数,求三个数中的最大值,要求定义max(x,y,z)函数

2024-12-18 23:44:26
推荐回答(2个)
回答1:

Function max(x as single, y as single, z as single)as single
Dim t As single
t = x
If y > t Then t = y
If z > t Then t = z
max = t
MsgBox "最大值" & max
End Function

回答2:

Function max(x as single, y as single, z as single) as single
Dim T As single
T = Iif( x > y, x, y)
max = Iif( T > z, T, z)
End Function