用vb编程:任意输入3个数,输出其中最大值,

2025-03-04 22:16:24
推荐回答(4个)
回答1:

Private Sub Command1_Click()
a = Val(InputBox("请输入第一个数"))
b = Val(InputBox("请输入第二个数"))
Print "你输入的数分别是:"; a; "和"; b
Print "其中较大数是:";
If a > b Then
Print a
Else
Print b
End If
End Sub

回答2:

public function max(a as integer,b as integer,c as integer) as integer
max=iif(a>iif(b>c,b,c),a,iif(b>c,b,c))
end function

使用VB6.0已经测试通过。

回答3:

a=XX
b=YY
c=MM
if a>b then
max=a
else
max=b
end if
if c>max then
max=c
end if

回答4:

vb 里面有个求最大函数 max(),先比较两个数,然后把这个结果与第三个数再做一次求最大数不就可以了吗