C语言 万年历计算星期几的问题week=(dy+dm+day-1+6)%7;if(week
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/24 20:25:31
C语言 万年历计算星期几的问题week=(dy+dm+day-1+6)%7;if(week
C语言 万年历计算星期几的问题
week=(dy+dm+day-1+6)%7;
if(week
C语言 万年历计算星期几的问题week=(dy+dm+day-1+6)%7;if(week
#include
#include
#include
int main()
{
int c,i,x,s,num,year,month,day,j=1,k=1;
//SYSTEMTIME sysT;
//GetSystemTime(&sysT);
//year=sysT.wYear;
//month=sysT.wMonth;
coutmonth;
{
if(((year%4==0)&&(year%100!=0))||(year%400==0)) x=29;
else x=28;
if (month==1) c=1;
else if (month==2) c=31+1;
else if (month==3) c=31+x+1;
else if (month==4) c=31+31+x+1;
else if (month==5) c=31+31+30+x+1;
else if (month==6) c=31+31+30+31+x+1;
else if (month==7) c=31+31+30+31+30+x+1;
else if (month==8) c=31+31+30+31+30+31+x+1;
else if (month==9) c=31+31+30+31+30+31+31+x+1;
else if (month==10) c=31+31+30+31+30+31+31+30+x+1;
else if (month==11) c=31+31+30+31+30+31+31+30+31+x+1;
else if (month==12) c=31+31+30+31+30+31+31+30+31+30+x+1;
}
s=year-1+(year-1)/4-(year-1)/100+(year-1)/400+c;
num=s%7;
{
if (month==1||month==3||month==5||month==7||month==8||month==10||month==12) day=31;
else if (month==4||month==6||month==9||month==11) day=30;
else if (month=2&&(((year%4==0)&&(year%100!=0))||(year%400==0))) day=29;
else day=28;
}
cout