getch和getchar的改写

来源:百度知道 编辑:UC知道 时间:2024/09/28 10:32:12
有一道题
include<stdio.h>
main()
{
printf("请输入文本:");
c=getchar();
while(c!=EOF){ putchar(c);
c=getchar();}
}
输入函数换成getch ; 谢谢

getch()不用回车,getchar(),要回车,包含头文件不一样式getch要有conio.h
getchar()要stdio.h即可

getchar():从键盘上输入一个字符+回车才把该字符输进去
getch():只要输入一个字符不需要输入回车就把该字符输进去了
此外getch()需要有头文件conio.h