要将"China"译成密码,密码规律是: 用原来的字母后面第 4 个字母代替原来的字母。例如字母 A 后面第 4 个字母是 E,用 E 代替 A。因此,"China"应译为"Glmre"。请编写一程序

#include<stdio.h>
int main(){
//定义字符变量并赋值。
char c1='C',c2='h',c3='i',c4='n',c5='a';
//混合运算
c1+=4;
c2+=4;
c3+=4;
c4+=4;
c5+=4;
//putchar输出
printf("putchar打出:");
putchar(c1);
putchar(c2);
putchar(c3);
putchar(c4);
putchar(c5);
putchar(10);//换行
printf("printf打出:");
printf("%c%c%c%c%c",c1,c2,c3,c4,c5);
printf("\n");//换行
return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_37536336/article/details/83178731
今日推荐