Option Explicit
Private Sub Command1_Click ()
As Integer Dim a, b As an Integer, c As Integer
A=Text1. Text
B=Text2. Text
C=Text3. Text
D=Text4. Text
If a & gt; Then b
If b & gt; Then c
D="a> B> C
"The Else
If a & gt; Then c
D="a> C> B
"The Else
D="c> a> B
"End the If
End the If
If a & gt; Then c
D="b> a> C
"The Else
If b & gt; Then c
D="b> C> A "
The Else
D="c> B> A "
End the If
End the If
End the If
End Sub
CodePudding user response:
D doesn't seem to give the definition
CodePudding user response:
reference 1st floor AK747k2011 response: d doesn't seem to give the definition? I this is the first time I get , how to define d? CodePudding user response:
And logic have some problem, the front end of the two end if only b> C and a> C, the first a> B no end judgment CodePudding user response:
And there may be the same, this also need to consider CodePudding user response:
refer to the second floor qq_44815320 response: Quote: refer to 1st floor AK747k2011 response: d doesn't seem to give the definition? I this is the first time I get , how to define d? Dim d as a string CodePudding user response:
Ok, thank you for your bosses to reassure, bother you?? CodePudding user response:
Should not use points number, string collation group, bubbling method such as circulation process for sorting? So things will become like this CodePudding user response:
Your code directly with string, then "2" & gt; "18" You definitely don't want CodePudding user response:
You this kind of sorting the more complex and the data the greater the amount of code is best not to use the I'll give you a set of '======================================================all kinds of collation API ' Option Explicit Global Const ZERO=0 Global Const ASCENDING_ORDER=0 Global Const DESCENDING_ORDER=1 Global gIterations Sub the BubbleSort (MyArray on (the), ByVal nOrder As Integer) Dim Index Dim TEMP Dim NextElement NextElement=ZERO Do the While (NextElement & lt; UBound (MyArray on)) The Index=UBound (MyArray on) Do the While (Index & gt; NextElement) If nOrder=ASCENDING_ORDER Then If MyArray on (Index) & lt; MyArray on (Index - 1) Then TEMP=MyArray on (Index) MyArray on (Index)=MyArray on Index (1) MyArray on Index (1)=TEMP End the If ElseIf nOrder=DESCENDING_ORDER Then If MyArray on (Index) & gt;=MyArray on (Index - 1) Then TEMP=MyArray on (Index) MyArray on (Index)=MyArray on Index (1) MyArray on Index (1)=TEMP End the If End the If The Index=Index - 1 GIterations=gIterations + 1 Loop NextElement=NextElement + 1 GIterations=gIterations + 1 Loop End Sub Sub Bucket (MyArray on (the), ByVal nOrder As Integer) Dim Index Dim NextElement Dim TheBucket NextElement=LBound (MyArray on) + 1 While (NextElement & lt;=UBound (MyArray on)) TheBucket=MyArray on (NextElement) The Index=NextElement Do If the Index & gt; LBound (MyArray on) Then If nOrder=ASCENDING_ORDER Then If TheBucket & lt; MyArray on (Index - 1) Then MyArray on (Index)=MyArray on Index (1) The Index=Index - 1 The Else The Exit Do End the If ElseIf nOrder=DESCENDING_ORDER Then If TheBucket & gt;=MyArray on (Index - 1) Then MyArray on (Index)=MyArray on Index (1) The Index=Index - 1 The Else The Exit Do End the If End the If The Else The Exit Do End the If GIterations=gIterations + 1 Loop MyArray on (Index)=TheBucket NextElement=NextElement + 1 GIterations=gIterations + 1 Wend End Sub Sub Heap (MyArray on ()) Dim Index Dim the Size Dim TEMP Size=UBound (MyArray on) The Index=1 While (Index & lt;=the Size) Call HeapSiftup (MyArray on (), the Index) The Index=Index + 1 GIterations=gIterations + 1 Wend The Index=Size While (Index & gt; 0) TEMP=MyArray on (0) MyArray on (0)=MyArray on (Index) MyArray on (Index)=TEMP Call HeapSiftdown (MyArray on (), the Index - 1) The Index=Index - 1 GIterations=gIterations + 1 Wend End Sub Sub HeapSiftdown (MyArray on (), M) Dim Index Dim Parent Dim TEMP The Index=0 The Parent=2 * Index Do the While (Parent & lt;=M) If (the Parent & lt; M And MyArray on (the Parent) & lt; MyArray on (the Parent + 1)) Then The Parent=Parent + 1 End the If If MyArray on (Index) & gt;=MyArray on (the Parent) Then The Exit Do End the If TEMP=MyArray on (Index) MyArray on (Index)=MyArray on (the Parent) MyArray on (the Parent)=TEMP The Index=Parent nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull