#include
void main()
{
int year,month,day;
int tempmonth,yearday;
int week,weekday;
unsigned int sum=0;
int tag=0;
printf("输入年、月、日:\n");
scanf("%d %d %d",&year,&month,&day);
tag =( year - 1980 )/4;
sum=(year-1984)*365 + tag;
tempmonth = month - 1;
yearday = 0;
switch(tempmonth)
{
case 12:yearday+=31;
case 11:yearday+=30;
case 10:yearday+=31;
case 9:yearday+=30;
case 8:yearday+=31;
case 7:yearday+=31;
case 6:yearday+=30;
case 5:yearday+=31;
case 4:yearday+=30;
case 3:yearday+=31;
case 2:yearday+=28;
case 1:yearday+=31;
}
yearday = yearday+day;
if ((year-1984)%4==0 && month > 2)
{
yearday+=1;
}
sum=sum+yearday;
if (year==1984)
{
sum-=1;
}
printf("距1984年1月1日一共有%d天\n",sum);
/*上面是计算输入的日期距1984年1月1日一共经历了多少天*/
weekday = (sum-1) % 7;
week = yearday / 7;
printf("今天是第%d个星期,星期%d",week,weekday);
return ;
}
才给这么点分。能多加点嘛?你看都没人给你做