*运动员成绩排名
clear
use 4-6.dbf
list off
n=reccount()
dimension a(n,2)
copy to array a(n,2) fields 运动员号码,成绩
for i=1 to n-1
for j=i to n
if a(i,2)>a(j,2)
t=a(i,2)
k=a(i,1)
a(i,2)=a(j,2)
a(i,1)=a(j,1)
a(j,2)=t
a(j,1)=k
endif
endfor
endfor
@2,40 say "运动员号码"
@2,80 say "成绩"
for i=1 to n
@2+i,41 say a(i,1)
@2+i,80 say str(a(i,2),4,1)
endfor
use
[img]http://www.our80s.com/bbs/photo/2004211205422.gif[/img]
|