第2个回答 2008-12-16
#include "stdafx.h"
#include "stdio.h"
void main()
{
int month,day,n,week;
printf("please input month:\n");
scanf("%d",&month);
printf("please input day:\n");
scanf("%d",&day);
switch(month)
{
case 1:
n=day;
printf("the day number is %d\n",n);
break;
case 2:
n=day+31;
printf("the day number is %d\n",n);
break;
case 3:
n=day+59;
printf("the day number is %d\n",n);
break;
case 4:
n=day+90;
printf("the day number is %d\n",n);
break;
case 5:
n=day+120;
printf("the day number is %d\n",n);
break;
case 6:
n=day+151;
printf("the day number is %d\n",n);
break;
case 7:
n=day+181;
printf("the day number is %d\n",n);
break;
case 8:
n=day+212;
printf("the day number is %d\n",n);
break;
case 9:
n=day+243;
printf("the day number is %d\n",n);
break;
case 10:
n=day+273;
printf("the day number is %d\n",n);
break;
case 11:
n=day+304;
printf("the day number is %d\n",n);
break;
case 12:
n=day+334;
printf("the day number is %d\n",n);
break;
default:
printf("error,please check\n");
}
week=(n+1)%7+1;
printf("today is week %d",week);
}
//数据正确性验证程序自己做吧,否则比如你输入一个2月50号会出错本回答被网友采纳