求高手帮我看看这段C语言错在哪?# include int main(){\x05int year,month,day,leap,error,tianshu,nianshu,week;\x05char question=121;\x05for(;question==89||question==121;){printf("请输入日期,如2012/1/1\n");\x05 scanf("%d/%d/%d",&year,&

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/17 21:55:28
求高手帮我看看这段C语言错在哪?#includeintmain(){\x05intyear,month,day,leap,error,tianshu,nianshu,week;\x05charques

求高手帮我看看这段C语言错在哪?# include int main(){\x05int year,month,day,leap,error,tianshu,nianshu,week;\x05char question=121;\x05for(;question==89||question==121;){printf("请输入日期,如2012/1/1\n");\x05 scanf("%d/%d/%d",&year,&
求高手帮我看看这段C语言错在哪?
# include
int main()
{
\x05int year,month,day,leap,error,tianshu,nianshu,week;
\x05char question=121;
\x05for(;question==89||question==121;)
{
printf("请输入日期,如2012/1/1\n");
\x05 scanf("%d/%d/%d",&year,&month,&day);
\x05 if((year%4==0&&year%100!=0)||year%400==0)
\x05 \x05 leap=1;
else
\x05\x05 leap=0;
//中间太长省略
\x05}
\x05\x05printf("是否继续查询?(y or n)\n");
\x05 \x05question=getchar();
\x05 }
\x05 return 0;
}
}
在getchar那里程序并没有暂停等待输入而是直接结束,最后question的值变成10.

求高手帮我看看这段C语言错在哪?# include int main(){\x05int year,month,day,leap,error,tianshu,nianshu,week;\x05char question=121;\x05for(;question==89||question==121;){printf("请输入日期,如2012/1/1\n");\x05 scanf("%d/%d/%d",&year,&
# include
int main()
{
int year,month,day,leap,error,tianshu,nianshu,week;
char question=121;
for(;question==89||question==121;)
{
printf("请输入日期,如2012/1/1\n");
scanf("%d/%d/%d",&year,&month,&day);
if((year%4==0&&year%100!=0)||year%400==0)
leap=1;
else
leap=0;
//中间太长省略
}
printf("是否继续查询?(y or n)\n");
getchar();//清除缓冲区里的回车符,要不然直接把回车符号读入question了,所以程序结束
question=getchar();
}
return 0;
}
}