@Dimster
Okay, but wouldn't something like this be easier?
Pete
Okay, but wouldn't something like this be easier?
Code: (Select All)
Width 80, 30: _Font 16
x$(1) = "Harry,35,180,Blue"
x$(2) = "Steve,52,400,Brown"
x$(3) = "Pete,70,165,Green"
x$(4) = "Fred,40,175,Blue"
x$(5) = "Jim,61,205,Brown"
Print "By Name:"
For i = 1 To 5
For j = i To 5 - 1
q$ = LCase$(Left$(x$(i), 1))
r$ = LCase$(Left$(x$(j + 1), 1))
If q$ > r$ Then Swap x$(i), x$(j + 1)
Next
Next
For i = 1 To 5
Print x$(i)
Next
Print
Print "By Age:"
For i = 1 To 5
For j = i To 5 - 1
age1 = Val(Mid$(x$(i), InStr(x$(i), ",") + 1))
age2 = Val(Mid$(x$(j + 1), InStr(x$(j + 1), ",") + 1))
If age1 > age2 Then Swap x$(i), x$(j + 1)
Next
Next
For i = 1 To 5
Print x$(i)
Next
Print
Print "By Weight:"
For i = 1 To 5
For j = i To 5 - 1
seed1 = InStr(x$(i), ",") + 1
wt1 = Val(Mid$(x$(i), InStr(seed1, x$(i), ",") + 1))
seed2 = InStr(x$(j + 1), ",") + 1
wt2 = Val(Mid$(x$(j + 1), InStr(seed2, x$(j + 1), ",") + 1))
If wt1 > wt2 Then Swap x$(i), x$(j + 1)
Next
Next
For i = 1 To 5
Print x$(i)
Next
Print
Print "By Eye Color:"
For i = 1 To 5
For j = i To 5 - 1
ec1$ = Mid$(x$(i), _InStrRev(x$(i), ",") + 1)
ec2$ = Mid$(x$(j + 1), _InStrRev(x$(j + 1), ",") + 1)
If ec1$ > ec2$ Then Swap x$(i), x$(j + 1)
Next
Next
For i = 1 To 5
Print x$(i)
Next
Pete
Shoot first and shoot people who ask questions, later.

