VB练习题从键盘输入任意三个数A,B,C,将其值按由大到小的顺序显示出来.
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/22 07:59:56
VB练习题从键盘输入任意三个数A,B,C,将其值按由大到小的顺序显示出来.
VB练习题
从键盘输入任意三个数A,B,C,将其值按由大到小的顺序显示出来.
VB练习题从键盘输入任意三个数A,B,C,将其值按由大到小的顺序显示出来.
Private Sub Form_Load()
Dim x As Integer,y As Integer,z As Integer
Dim diyige As Integer
Dim dierge As String,disange As String,disige As String
diyige = InputBox("请输入A:","数据输入")
dierge = InputBox("请输入B","数据输入")
disange = InputBox("请输入C","数据输入")
x = Val(diyige)
y = Val(dierge)
z = Val(disange)
If x > y And y > z Then
Print x,y,z
ElseIf y > z And z > x Then
Print y,z,x
ElseIf z > x And x > y Then
Print z,x,y
End If
Print "你输入的数据按从da到xiao的顺序是:"
End Sub
Private Sub Form_Click()
a = InputBox("A")
b = InputBox("B")
c = InputBox("C")
If b > a Then
d = a: a = b: b = d
End If
If c > a Then
d = a: a = c: c = d
End If
If c > b Then
d = b: b = c: c = d
End If
Print a, b, c
End Sub