请编程序将“China”译成密码,密码规律是:用原来字母后面第4个字母代替原来的字母。分别用putchar和printf函数输出这5个字符。

程序:

#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;

printf("用printf输出密码为:%c%c%c%c%c\n", c1, c2, c3, c4, c5);

printf("用putchar输出密码为:");

putchar(c1);

putchar(c2);

putchar(c3);

putchar(c4);

putchar(c5);

printf("\n");

return 0;

}

结果:

用printf输出密码为:Glmre

用putchar输出密码为:Glmre

请按任意键继续. . .