level 6
Private Sub Command1_Click()
Dim a
#, b#
, c
#, d#
a = Val(Text1)
b = Val(Text2)
c = Val(Text3)
If Not IsNumeric(Text1) Or Not IsNumeric(Text2) Or Not IsNumeric(Text3) Then
MsgBox "输入有误"
ElseIf a > b And b > c Then
Label2.Caption = "从小到大为:" & c & b & a&
ElseIf a > c And c > b Then
Label2.Caption = "从小到大为:" & b & c & a&
ElseIf b > c And c > a Then
Label2.Caption = "从小到大为:" & a & c & b&
ElseIf b > a And a > c Then
Label2.Caption = "从小到大为:" & c & a & b&
ElseIf c > a And a > b Then
Label2.Caption = "从小到大为:" & b & a & c&
ElseIf c > b And b > a Then
Label2.Caption = "从小到大为:" & a & b & c&
End If
End If
End Sub
Private Sub Command2_Click()
End
End Sub
2013年05月01日 14点05分
1
吧务
level 15
Label2.Caption = "从小到大为:" & c & b & a&
把最后一个字符删除,写代码绝不允许画蛇添足
2013年05月01日 14点05分
7
最后一个字符他自己默认的,删了就提示错误了
2013年05月01日 15点05分
吧务
level 15
Dim a#这声明的a是Double型
& a& 这里将a定义为Long类型
你这样的代码让电脑也头疼了,a倒底是Double还是Long
2013年05月01日 14点05分
8
caption中的&是什么意思啊?我是模仿书上的写的,不太懂
2013年05月01日 15点05分
我把#全部改为&后差不多行了,可是输出的时候太紧凑了,怎么办
2013年05月01日 15点05分
吧务
level 13
Private Sub Command1_Click() Dim a As Long, b As Long, c As Long a = Val(Text1) b = Val(Text2) c = Val(Text3) If Not IsNumeric(Text1) Or Not IsNumeric(Text2) Or Not IsNumeric(Text3) Then MsgBox "输入有误" ElseIf a > b And b > c Then Label2.Caption = "从小到大为:" & c & b & a ElseIf a > c And c > b Then Label2.Caption = "从小到大为:" & b & c & a ElseIf b > c And c > a Then Label2.Caption = "从小到大为:" & a & c & b ElseIf b > a And a > c Then Label2.Caption = "从小到大为:" & c & a & b ElseIf c > a And a > b Then Label2.Caption = "从小到大为:" & b & a & c ElseIf c > b And b > a Then Label2.Caption = "从小到大为:" & a & b & c End IfEnd Sub
2013年05月01日 15点05分
10
为什么输出时系统自己在每个输出后边多加了一个&?
2013年05月01日 16点05分
level 14
Private Sub Command1_Click()
Dim a()
a = Array(Val(Text1.Text), Val(Text2.Text), Val(Text3.Text))
Call Sort(a, True) 'True:从小到大, False:从大到小
Label2.Caption = "从小到大为:" & a(0) & " " & a(1) & " " & a(2)
End Sub
Sub Sort(Arr(), Optional ByVal Order As Boolean = True)
Dim i As Integer, J As Integer, t
For i = 0 To UBound(Arr)
DoEvents
For J = 0 To UBound(Arr)
If (Arr(i) < Arr(J)) = Order And i <> J Then
t = Arr(i)
Arr(i) = Arr(J)
Arr(J) = t
End If
Next
Next
End Sub
2013年05月02日 03点05分
15
吧务
level 11
Private Sub Command1_Click()
Dim a
#, b#
, c
#, d#
a = Val(Text1)
b = Val(Text2)
c = Val(Text3)
If Not IsNumeric(Text1) Or Not IsNumeric(Text2) Or Not IsNumeric(Text3) Then
MsgBox "输入有误"
ElseIf a > b And b > c Then
Label2.Caption = "从小到大为:" & c & b & a
ElseIf a > c And c > b Then
Label2.Caption = "从小到大为:" & b & c & a
ElseIf b > c And c > a Then
Label2.Caption = "从小到大为:" & a & c & b
ElseIf b > a And a > c Then
Label2.Caption = "从小到大为:" & c & a & b
ElseIf c > a And a > b Then
Label2.Caption = "从小到大为:" & b & a & c
ElseIf c > b And b > a Then
Label2.Caption = "从小到大为:" & a & b & c
End If
End If
End Sub
Private Sub Command2_Click()
End
End Sub
2013年05月02日 12点05分
16