您的位置:首页 > 编程语言 > VB

输出三个数中的最大值

2012-05-18 08:40 176 查看
dim a as integer,b as integer,c as integer,max as integer 

a=Val(text1.text)

b=Val(text2.text)

c=Val(text3.text)

Max = IIf(a > b,a,b)

Max = IIf(Max > c, Max,c)

print "最大数为:" & Max

今天看了一会儿书发现用IIF也能输出最大值。看来VB真的是很奇妙,一个程序可以利用多种代码编写。

 

以前用的是if....then .

if a>b then

max=a

else

max=b

end if

if max< c then

max=c

end if

嘿嘿!真是条条大路通罗马啊!!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  integer vb c