以下是引用Knocker在2007-9-2 9:41:39的发言:
#include <stdio.h>
main(o){main(printf(&"不是闰年\n"[((!(o%4)&& o%100)||!(o%400))<<1],printf("%d年",o),scanf("%d",&o,printf("请输入年份:\n"))));}
什么意思啊..分析一下啊...
----------------解决方案--------------------------------------------------------
给你简化以下你不介意吧
#include <stdio.h>
main(o){main(printf("%d年%s",o,&"不是闰年\n"[((!(o%4)&& o%100)||!(o%400))<<1],scanf("%d",&o,printf("请输入年份:\n"))));}
----------------解决方案--------------------------------------------------------
唉,笨徒弟,printf("%d年%s",这个%s不就明确了后面的什么了么
----------------解决方案--------------------------------------------------------
void main()
{
int year;
printf("请输入年份");
scanf("%d",&year);
if ((year % 4 ==0 && (year % 100 <0 || year % 100 > 0))||(year % 400 ==0))
printf("%d年是闰年\n",year);
else
printf("%d年不是闰年\n",year);
}
----------------解决方案--------------------------------------------------------