#include <stdio.h>int main() { /* 定义需要计算的日期 */ int year = 2008; int month = 8; int d = 8; int s=0; if(year%4==0&&year%100!=0||year%400==0) { switch(month) { case 1: s=s+d;break; case 2: s=s+31+d;break; case 3: s=s+31+29+d;break; case 4: s=s+31+29+31+d;break; case 5: s=s+31+29+31+30+d;break; case 6: s=s+31+29+31+30+31+d;break; case 7: s=s+31+29+31+30+31+30+d;break; case 8: s=s+31+29+31+30+31+30+31+d;break; case 9: s=s+31+29+31+30+31+30+31+31+d;break; case 10: s=s+31+29+31+30+31+30+31+31+30+d;break; case 11: s=s+31+29+31+30+31+30+31+31+30+31+d;break; case 12: s=s+31+29+31+30+31+30+31+31+30+31+30+d;break; } printf("%d年的%d月%d日是该年的第%d天",year,month,d,s); } else { switch(month) { case 1: s=s+d;break; case 2: s=s+31+d;break; case 3: s=s+31+28+d;break; case 4: s=s+31+28+31+d;break; case 5: s=s+31+28+31+30+d;break; case 6: s=s+31+28+31+30+31+d;break; case 7: s=s+31+28+31+30+31+30+d;break; case 8: s=s+31+28+31+30+31+30+31+d;break; case 9: s=s+31+28+31+30+31+30+31+31+d;break; case 10: s=s+31+28+31+30+31+30+31+31+30+d;break; case 11: s=s+31+28+31+30+31+30+31+31+30+31+d;break; case 12: s=s+31+28+31+30+31+30+31+31+30+31+30+d;break; } printf("%d年的%d月%d日是该年的第%d天",year,month,d,s); } return 0;}