C语言完美演绎4-10
/* 范例4-10 */#include conio.h /* getche()、getch()需要含入头文件conio.h */#include stdio.h /* getchar(),putchar(),puts() 需要含入stdio.h */void main(){char ch1,ch2,ch3;printf(请输入字符串后按Enter键,getchar()会取第一个字符\n);ch1getchar();printf(输入一字符,getche()函数读取该字符,并输出到屏幕\n);ch2getche();printf(\n输入一字符,getch()函数读取该字符,但不会显示到屏幕\n);ch3getch();printf(\n以putchar()输出getchar()函数所读取的字符\n);putchar(ch1);printf(\nputs()函数输出字符串\cPuts\\n);puts(cPuts);getch(); /* getch()函数在此的目的只是要使程序暂停 */}程序执行结果请输入字符串后按Enter键,getchar()会取第一个字符ABC输入一字符,getche()函数读取该字符,并输出到屏幕D输入一字符,getch()函数读取该字符,但不会显示至屏幕以putchar()输出getchar()函数所读取的字符Aputs()函数输出字符串cPutscPuts