Vb输入三个数,按从小到大的次序显示

2024-12-31 13:20:01
推荐回答(2个)
回答1:

先建3个文本框
sub command1_click()
x=val(text1.text)
y=val(text2.txet)
z=val(text3.txet)
if x>y then
if x>z then print x else print z
else
if y>z then print y else print z
end if
end sub

回答2:

Show
x = 8: y = 12: z = 2
Dim a(1 To 3)
a(1) = x: a(2) = y: a(3) = z
For i = 1 To 2
For j = 1 To 3 - i
If a(j) > a(j + 1) Then
s = a(j)
a(j) = a(j + 1)
a(j + 1) = s
End If
Next j
Next i
For i = 1 To 3
Print a(i)
Next i