35 lines
639 B
Plaintext
35 lines
639 B
Plaintext
' Lexicographical numbers - 25/07/2018
|
|
xx="000000000000000"
|
|
For n=1 To 3
|
|
nn=Text.GetSubText(" 5 13 21",n*4-3,4)
|
|
ll=Text.GetLength(nn)
|
|
For i=1 To nn
|
|
t[i]=i
|
|
EndFor
|
|
i=nn-1
|
|
k=0
|
|
For i=i To 1 Step -1
|
|
ok=1
|
|
For j=1 To i
|
|
k=j+1
|
|
tj=Text.GetSubText(Text.Append(t[j],xx),1,ll)
|
|
tk=Text.GetSubText(Text.Append(t[k],xx),1,ll)
|
|
If tj>tk Then
|
|
w=t[j]
|
|
t[j]=t[k]
|
|
t[k]=w
|
|
ok=0
|
|
EndIf
|
|
EndFor
|
|
If ok=1 Then
|
|
Goto exitfor
|
|
EndIf
|
|
EndFor
|
|
exitfor:
|
|
x=""
|
|
For i=1 To nn
|
|
x=x+","+t[i]
|
|
EndFor
|
|
TextWindow.WriteLine(nn+":"+Text.GetSubTextToEnd(x,2))
|
|
EndFor
|