c语言如何实现按Y键继续循环,但屏幕上不显示所输入的Y
用getch函数可以实现
#include <stdio.h>
int main()
{
char ch;
while(1)
{
printf("hello\n");
ch = getch();
if(ch == 'Y')
continue;
break;
}
return 0;
}
getche只能在windows上使用,Linux不支持。