编写一个译码程序,把一个英语句子译成数字代码.译码规则是以数字1代替字母A,数字2代替字母B,……,26代替字母Z,如遇空格则打印一个星号‘*’,英文句子以‘.‘结束.大家帮个忙,(注:答案最好是pascal的)
网友回答
用 for vars:ansistring;
i,j,k,p:longint;
beginreadln(s);
for i:=1 to length(s)-1 do
case s[i] of
'A'..'Z': write(ord(s[i])-64);
end;end.用 while
varch:char;
beginread(ch);
while ch'.' do
begin case ch of
'A'..'Z': write(ord(ch)-64);
' ': write('*');
end; read(ch);
end;end.