当我运行以下代码片段时,它会一直运行到第二个问题。然后将“客户是否为学生?(y / n)\n”和“电影时间是多少?(以小时为单位)\n”提示放在一起(它们之间没有回答区域)。如果从那里采取任何行动,程序将停止工作。我做错了什么?(我很确定这与语法有关)
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);
scanf
:http://c-faq.com/stdio/scanfprobs.html - jamesdlin