當前位置:編程學習大全網 - 編程軟體 - pascal 編程!!(要程序)用的是freePascal

pascal 編程!!(要程序)用的是freePascal

var

st:string;

i,j,t,k:longint;

a:array[1..60] of boolean; //是否大寫英文字母

b:array[1..60] of longint; //大寫英文字母的編碼

begin

readln(st); //讀字符串

fillchar(a,sizeof(a),true); //初始化為全部都是英文字母

t:=0;

for i:=1 to length(st) do

begin

if (ord(st[i])>=65) and (ord(st[i])<=90) then

begin

t:=t+1;

b[t]:=ord(st[i]); //如果是英文字母,則存下它的編碼

end

else a[i]:=false; //如果不是,則標記這個不是英文字母,不用更改

end;

for i:=1 to t-1 do

for j:=i+1 to t do

if b[i]>b[j] then

begin

k:=b[i];

b[i]:=b[j];

b[j]:=k;

end; //選擇排序

i:=1;

for j:=1 to t do

begin

while a[i]=false do i:=i+1; //找到英文字母的位置

st[i]:=chr(b[j]); //更改為英文字母的新排列

i:=i+1;

end;

writeln(st);

end.

註:因為題目中沒有說明超過60個字符的英文文字應該怎麽處理,所以此程序只能處理不超過60個字符的英文文字!

  • 上一篇:到哪兒去找php.exe
  • 下一篇:怎麽給CAD圖紙加密?讓他只能看,不能操作修改?
  • copyright 2024編程學習大全網