[ZJ]b516: 凱撒密碼
題目:
--------------------------------------------------------------------------------------------------------------------------
#include<cstdio>
#include<cstring>
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
char s[15];
memset(s,' ',sizeof(s));
scanf("%s",&s);
int len = strlen(s);
for(int i=0;i<len;i++)
{
if(s[i] == 'X')
printf("A");
else if(s[i] == 'Y')
printf("B");
else if(s[i] == 'Z')
printf("C");
else
printf("%c",s[i]+3);
}
printf("\n");
}
return 0;
}
留言
張貼留言