#include<stdio.h>
#include<math.h>
#include<string.h>
int main() {
int j=0, n;
char ch[80], tran[80];
printf("请输入原文:");
gets_s(ch);
while (ch[j]!='\0')
{
if ((ch[j] >= 'A') && (ch[j] <= 'Z'))
tran[j] = 155 - ch[j];
else if ((ch[j] >= 'a') && (ch[j] <= 'z'))
tran[j] = 219 - ch[j];
else
tran[j] = ch[j];
j++;
}
n = j;
printf("\n密文是:");
for (j = 0; j < n; j++)
putchar(tran[j]);
printf("\n");
return 0;
}
电文译成密文:A----Z,B----Y,a-----z,b-----y
最新推荐文章于 2022-11-16 08:30:00 发布