習題:編程將"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 }
相關文章
相關標籤/搜索