# Re: 如何依序排列

Posted by dar on April 07, 1999 at 18:14:11:

In Reply to: 如何依序排列 posted by 小祥 on March 31, 1999 at 21:44:40:

dim a(10000) as string
dim i as integer
dim j as integer
dim k as integer
dim s as string

i=0
open "abc.txt" for input as #1
while not eof(1)
line input #1,a(i)
i=i+1
wend
close #1
i=i-1
for j=0 to i-1
for k=j+1 to i
if a(j)>a(k) then
s=a(j)
a(j)=a(k)
a(k)=s
endif
next k
next j
open "def.txt" for output as #2
for j=0 to i
print #2,a(j)
next j
close #2

Follow Ups: