题目:http://acm.hdu.edu.cn/showproblem.php?pid=1048
输入一串字符,对其进行加密。将一个字母换成ascii+21的字母。若超过Z,返回到A继续。
#include<stdio.h>
#include<string.h>
int main()
{
char a[20], b[150];
while (gets(a))
{
memset(b, 0, sizeof(b));
if (!strcmp(a, "START"))
{
gets(b); int num = strlen(b);
for (int i = 0; i < num; i++)
{
if (b[i] >= 'F' &&b[i]<= 'Z')
b[i] -= 5;
else if (b[i] >= 'A'&&b[i] < 'F')
b[i] += 21;
}
printf("%s\n", b);
}
else if (!strcmp(a, "ENDOFINPUT"))
break;
memset(a, 0, sizeof(a));
}
return 0;
}