相关代码 |
|
var f,g:text; max,i,j,p:integer; v:array[1..20] of string; aux:string; begin assign(f,'f.txt');reset(f); assign(g,'g.txt');rewrite(g); p:=0; while not eof(f) do begin inc(p); read(f,v[p]); readln(f); end; for i:=1 to p-1 do for j:=i+1 to p do if length(v[i]) aux:=v[i]; v[i]:=v[j]; v[j]:=aux; end; for i:=1 to p do writeln(g,v[i]); close(f); close(g); end.