VB if判断

来源:百度知道 编辑:UC知道 时间:2024/09/28 06:42:26
dim x as integer, a as integer,b as integer,c as integer
x=int(rnd*3)+1
a=1
b=2
c=3
我想判断x与a,b,c三个数的大小
如果x>a,x>b,x>c
那么label1.caption="x为最大数"
如果x=a,x=b,x=c
那么label1.caption="x与a,b,c相等"
如果x<a,x<b,x<c
那么label1.caption="x为最小数"

请教下大家语句要怎么写?

if x>a and x>b and x>c then label1.caption="x为最大数"
if x=a and x=b and x=c then label1.caption="x与a,b,c相等"
if x<a and x<b and x<c then label1.caption="x为最小数"

简单啊!
你直接判断a,b谁大,然后和c比较就完了!就找到最大的了!