c语言 请编程序将 China 译成密码,分别用putchar和printf函数输出这5个字符

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

请编程序将“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

请按任意键继续. . .


本文出自 “岩枭” 博客,请务必保留此出处http://yaoyaolx.blog.51cto.com/10732111/1740254

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/qq_43667626/article/details/84028281