用VB编写程序,使得任意输入3个整数按大到小的顺序输出。能用if嵌套吗

能用if嵌套吗,若能最好用if嵌套

当然能用If嵌套。在窗体上添加4个文本框和1个按钮,Text1、Text2和Text3输入,Text4输出。
Private
Sub
Command1_Click()
Dim
a
As
Integer
Dim
b
As
Integer
Dim
c
As
Integer
a
=
Val(Text1.Text)
b
=
Val(Text2.Text)
c
=
Val(Text3.Text)
If
a
>
b
Then
If
a
>
c
Then
If
b
>
c
Then
Text4.Text
=
a
&
"
"
&
b
&
"
"
&
c
Else
Text4.Text
=
a
&
"
"
&
c
&
"
"
&
b
End
If
Else
Text4.Text
=
c
&
"
"
&
a
&
"
"
&
b
End
If
Else
If
b
>
c
Then
If
a
>
c
Then
Text4.Text
=
b
&
"
"
&
a
&
"
"
&
c
Else
Text4.Text
=
b
&
"
"
&
c
&
"
"
&
a
End
If
Else
Text4.Text
=
c
&
"
"
&
b
&
"
"
&
a
End
If
End
If
End
Sub
温馨提示:答案为网友推荐,仅供参考
相似回答
大家正在搜