当前位置:天才代写 > tutorial > C语言/C++ 教程 > C与C++中尺度输入实现方法上的区别

C与C++中尺度输入实现方法上的区别

2017-11-07 08:00 星期二 所属: C语言/C++ 教程 浏览:470

刚开始学C语言时碰着一个问题,如下代码:

#include
int main()
...{
char a,b;
printf("Please input the first character:");
scanf("%c", &a);
printf("Please input the second character:");
scanf("%c", &b);
printf("The two characters are %c, %c", a, b);
return 0;
}

措施运行功效如下:

C与C++中标准输入实现要领上的区别

而下面这段措施却可以正常运行:

#include
int main()
...{
char a;
int b;
printf("Please input the first character:");
scanf("%c", &a);
printf("Please input the second integer:");
scanf("%d", &b);
printf("The two characters are %c, %d", a, b);
return 0;
}

运行功效如下:

 

    关键字:

天才代写-代写联系方式