VB程序设计 怎样设计程序 求三个数中的最大数
发布网友
发布时间:2024-08-19 11:15
我来回答
共2个回答
热心网友
时间:2024-08-26 20:10
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer, s As Integer, t As Integer
a = Val(text1.Text)
b = Val(text2.Text)
c = Val(text3.Text)
s = IIf(a > b, a, b)
t = IIf(s > c, s, c)
label1.Caption = "最大数为" & Str(t)
End SubPrivate Sub Command2_Click()
Unload Me
End Sub
热心网友
时间:2024-08-26 20:03
假设 三个数字为 a,b,c,你设置个text输入自己想要比较的数字
dim a as integer, b as integer,c as integer,i as integer
dim a() as integer
a=text1:b=text2:c=text3
redim a(3)
a(1)=a:a(2)=b:a(3)=c
for i=1 to 2
for j= i+1 to 3
if a(i)<a(j) then
temp=a(i)
a(i)=a(j)
a(j)=temp
end if
next j
next i