电文保密

{电文保密
魔法世界电报局的电文保密的规律是将每个英文字母变成其后的第4个字母,如A变成E,a变成e。
最后的4个大写字母W、X、Y、Z分别变为A、B、C、D。非字母字符不变。输入一行字符,要求输出相应的密码。
}
var 
    a: string;
    i : integer;
begin
    readln(a);
    for i:=1 to length(a) do 
    begin 
        //    writeln(ord(' '));
            if( a>= 'A' )and( a[i] < 'W') then
                a[i] := chr(ord(a[i]) + 4)
            else if( a[i]>= 'W' )and( a[i] <= 'Z') then
                a[i] := chr(ord(a[i])  + 4 -26)
            else if( a>= 'a' )and( a[i] < 'w') then
                a[i] := chr(ord(a[i]) + 4)
            else if( a[i]>= 'w' )and( a[i] <= 'z') then
                a[i] := chr(ord(a[i])  + 4 -26);
    end;
    writeln(a);
end.
原文地址:https://www.cnblogs.com/shiningrise/p/6543006.html