C语言请教
intweeks(longyear,intmouth,intday)/*计算公元某年某月某日是星期几函数*/{longS;intXing_qi,C;switch(isle...
int weeks(long year,int mouth,int day) /*计算公元某年某月某日是星期几函数*/
{
long S;
int Xing_qi,C;
switch(isleap(year))
{
case 0:
switch(mouth)
{
case 1: C=day;break;
case 2: C=31+day;break;
case 3: C=59+day;break;
case 4: C=90+day;break;
case 5: C=120+day;break;
case 6: C=151+day;break;
case 7: C=181+day;break;
case 8: C=212+day;break;
case 9: C=243+day;break;
case 10: C=273+day;break;
case 11: C=304+day;break;
case 12: C=334+day;break;
default : break;
} break;
case 1:
switch(mouth)
{
case 1: C=day;break;
case 2: C=31+day;break;
case 3: C=60+day;break;
case 4: C=91+day;break;
case 5: C=121+day;break;
case 6: C=152+day;break;
case 7: C=182+day;break;
case 8: C=213+day;break;
case 9: C=244+day;break;
case 10: C=274+day;break;
case 11: C=305+day;break;
case 12: C=335+day;break;
default : break;
} break;
}
S=(year-1)+(year-1)/4-(year-1)/100+(year-1)/400+C;
Xing_qi=S%7;
return Xing_qi;
}
请问这段C语言中的S=(year-1)+(year-1)/4-(year-1)/100+(year-1)/400+C; 是什么意思??? 展开
{
long S;
int Xing_qi,C;
switch(isleap(year))
{
case 0:
switch(mouth)
{
case 1: C=day;break;
case 2: C=31+day;break;
case 3: C=59+day;break;
case 4: C=90+day;break;
case 5: C=120+day;break;
case 6: C=151+day;break;
case 7: C=181+day;break;
case 8: C=212+day;break;
case 9: C=243+day;break;
case 10: C=273+day;break;
case 11: C=304+day;break;
case 12: C=334+day;break;
default : break;
} break;
case 1:
switch(mouth)
{
case 1: C=day;break;
case 2: C=31+day;break;
case 3: C=60+day;break;
case 4: C=91+day;break;
case 5: C=121+day;break;
case 6: C=152+day;break;
case 7: C=182+day;break;
case 8: C=213+day;break;
case 9: C=244+day;break;
case 10: C=274+day;break;
case 11: C=305+day;break;
case 12: C=335+day;break;
default : break;
} break;
}
S=(year-1)+(year-1)/4-(year-1)/100+(year-1)/400+C;
Xing_qi=S%7;
return Xing_qi;
}
请问这段C语言中的S=(year-1)+(year-1)/4-(year-1)/100+(year-1)/400+C; 是什么意思??? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询