C语言中,do...while语句,输入Y时继续,输入N时退出程序,当输入其它字符时,要求继续输入,

2025-02-01 05:58:34
推荐回答(1个)
回答1:

char cA;
do
{
cA = getch();
if( cA == 'Y' ) { printf("Yes"); }
else if( cA == 'N' ) { printf("Exit"); }
else { printf("Keeping input"); }
}
while( cA!='N');