#include
int main()
{
char a;
int i=6;
while(--i)
{
printf("You have %d chances.Please input a character:",i);
a=getchar();
getchar();
if(a=='A')
{
printf("Congratulations!\n");
break;
}
else{
printf("Please try again.\n");
}
}
if(i==0)
printf("You've tried too many times!\n");
getchar();
return 0;
}
你试下把 getch();放到 scanf("%c",&a);的后面
scanf("%c",&a);//在他后面加上这句!!!就好了
getchar();//
scanf之后加
getchar()接收 回车
循环内部放一个getchar()