當前位置:成語大全網 - 新華字典 - 急!!!! pascal 數字 (不是英文字母)字典序大小怎麽比較 要詳細點!!

急!!!! pascal 數字 (不是英文字母)字典序大小怎麽比較 要詳細點!!

當然是3124大了,比較的時候是每個數的左起第i位分別比較,下面是壹個n個字符串進行字典序排序的程序,希望對妳有用:

var

i,j,n:longint;

a:array[1..1000] of string;

temp:string;

begin

readln(n);

for i:=1 to n do readln(a[i]);

for i:=1 to n-1 do

for j:=i+1 to n do

if (a[i]+a[j])<(a[j]+a[i]) then begin

temp:=a[i];

a[i]:=a[j];

a[j]:=temp;

end;

for i:=1 to n do writeln(a[i]);

end.