/*
time:2016.6.20
function:
aim:用于测试getchar()方法的作用
*/
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char a, b, c; //声明3个整型变量
printf("press key to input a:\n");
scanf("%c", &a); //用scanf()函数接收键盘输入的整型数据
getchar();
printf("press key to input b:\n");
scanf("%c", &b); //用scanf()函数接收从键盘输入的整型数据放入变量b中
getchar();
printf("press key to input c:\n");
scanf("%c", &c); //用scanf()函数接收从键盘中输入的整型数据放入变量c中
getchar();
printf("%c,%c,%c", a, b, c); //将三个变量输出
return 0;
}
/*
在codeblocks中的运算结果是:
————————————
press key to input a:
1
press key to input b:
2
press key to input c:
2
1,2,2
————————————
总结:
*/