习题:编程将"China"译成密码,用原字母后的第四位替换原字母,用putchar 和printf函数输出。

 1 /*请编程将"China"译成密码,用原字母后的第四位替换原字母,用putchar 和printf函数输出*/
 2 #include<stdio.h>
 3 main()
 4 {
 5     char ch1='C',ch2='h',ch3='i',ch4='n',ch5='a';
 6     printf("the source Character is: %c%c%c%c%c\n",ch1,ch2,ch3,ch4,ch5);
 7     printf("the Be encrypted characters is :%c%c%c%c%c\n",ch1+4,ch2+4,ch3+4,ch4+4,ch5+4);
 8     putchar(ch1+4);
 9     putchar(ch2+4);
10     putchar(ch3+4);
11     putchar(ch4+4);
12     putchar(ch5+4);
13     printf("\n");
14     return 0;
15 }
相关文章
相关标签/搜索