VB的:输入三个数X、Y、Z,按从小到大的顺序输出这三个数Private Sub Command1_Click()a = Text1.Text:b = Text2.Text:c = Text3.TextIf a > b Then m = a:n = bElse:m = b:n = aEnd IfIf n > c ThenLabel1.Caption = m > n > cElseIf m < c Then
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/28 10:23:48
VB的:输入三个数X、Y、Z,按从小到大的顺序输出这三个数Private Sub Command1_Click()a = Text1.Text:b = Text2.Text:c = Text3.TextIf a > b Then m = a:n = bElse:m = b:n = aEnd IfIf n > c ThenLabel1.Caption = m > n > cElseIf m < c Then
VB的:输入三个数X、Y、Z,按从小到大的顺序输出这三个数
Private Sub Command1_Click()
a = Text1.Text:b = Text2.Text:c = Text3.Text
If a > b Then m = a:n = b
Else:m = b:n = a
End If
If n > c Then
Label1.Caption = m > n > c
ElseIf m < c Then
Label1.Caption = c > m > n
Else
Label1.Caption = m > c > n
End If
为什么提示我说第一个else没有IF啊啊?不是有么.
VB的:输入三个数X、Y、Z,按从小到大的顺序输出这三个数Private Sub Command1_Click()a = Text1.Text:b = Text2.Text:c = Text3.TextIf a > b Then m = a:n = bElse:m = b:n = aEnd IfIf n > c ThenLabel1.Caption = m > n > cElseIf m < c Then
THEN 后面直接换行!(或加冒号 : )
你的程序太乱!题目中是X、Y、Z,程序中是a、b、c,一会儿又有m、n
这样写:
Private Sub Command1_Click()
X = Text1.Text: Y = Text2.Text: Z = Text3.Text
If X>Y Then m = X : X = Y : Y = m
If X>Z Then m = X : X = Z : Z = m
If Y>Z Then m = Y : Y = Z : Z = m
Label1.Caption = X & " < " & Y & " < " Z
End Sub