當我運行下面的代碼片段時,它會運行到第二個問題。然後它將「客戶是學生嗎?(y/n)\ n」和「什麼是電影時間?(以小時爲單位)\ n」一起提示(沒有區域來回答他們之間的問題)。如果從那裏採取任何行動,程序將停止工作。我做錯了什麼? (我敢肯定它的語法關係)使用C scanf語法的幫助
int A,B,C,D,age,time;
char edu, ddd;
printf ("What is the customer's age? \n");
scanf("%d", &age);
printf ("Is the customer a student? (y/n) \n");
scanf("%c", &edu);
printf ("What is the movies time? (in hours) \n");
scanf("%d", &time);
printf ("Is the movie 3-D? (y/n) \n");
scanf("%c", &ddd);
[This](http://stackoverflow.com/questions/1669821/scanf-skips-every-other-while-loop-in-c)可能會有所幫助。 – sje397 2010-09-16 04:45:29
最好避免使用'scanf':http://c-faq.com/stdio/scanfprobs.html – jamesdlin 2010-09-16 05:52:44