还是直接看程序吧有问题:
#include<stdio.h>
int date=0;
void week()/*判断这一天是星期几*/
{switch(date%7)
case0: printf("That Day Is SUNDAY");break;
case1: printf("That Day Is MONDAY");break;
case2: printf("That Day IS TUESDAY");break;
case3: printf("That Day Is WENSDAY");break;
case4: printf("That Day Is THURSDAY");break;
case5: printf("That Day Is FIRDAY");break;
case6: printf("That Day Is SATURDAY");break;
}
main()
{
int b,i,k,year,leap,month,day;
int monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
clrscr();
clrscr();printf("Please Input a Year:") ;
scanf("%d",&year);
if(year%4==0)/*判断闰年*/
{ if(year%100==0)
{ if(year%400==0)
leap=1;
else leap=0;
}
else leap=1;
}
else leap=0;
cl-rscr();
printf("Please Input a Month:") ;
scanf("%d",&month);
while(1)
{
if(month>12||month<=0)
{
printf("Input Error!Please Input a Month Again:") ;
scanf("%d",&month);
}
else{
clrscr();
break;
}
}
printf("Please Input a Day:");
scanf("%d",&day);
for(i=0;i<month-1;i++)
{ date=monthday[i]+date ;
}
if(leap==1) date++;
date=date+day;
clrscr();/*输出这一天是这一年的第几天*/
printf("%d,%d,%d Is The %d Day Of The Year",year,month,day,date);
week();
return 0;
}