最近写的排序都是同一个错误,高手来看看!
程序代码:
const minlen=5; procedure qd(rcdlist:array of integer); var t,k,j,i:integer; begin for i:=0 to length(rcdlist)-1 do begin k:=i; for j:=i+1 to length(rcdlist) do if rcdlist[j]<rcdlist[k] then k:=j; if k<>i then begin t:=rcdlist[i];rcdlist[i]:=rcdlist[k];rcdlist[k]:=t; end; end; end; var list:array[1..10] of integer; i:integer; begin randomize; for i:=1 to 10 do list[i]:=random(20); for i:=1 to 10 do write(list[i],' '); qd(list); end.