香奈儿唇线笔色号:vb程序源代码,单词排序

来源:百度文库 编辑:高校问答 时间:2024/04/26 16:33:45

你首先要把你的单词存入一个文件中(如:Word.txt),第行一个单词,然后读入这个文件进行排序。
如:
Dim S() As String, i As Integer, j as Integer, p as Integer, m as integer, a as string
open "word.txt" for input as #1
do while not eof(1)
input #1,a
i=i+1
s(i)=a
loop
close #1
for j=1 to i-1
m=j
for p=j+1 to i
if s(m)>s(p) then m=p
next p
if m<>j then
temp = s(j)
s(j) = s(m)
s(m) = temp
end if
next j
.......

现在数组S()中就存有排序好的单词了。