急求C++程序 一定C++ 请完整 好的话一定提高悬赏 非常感谢

来源:百度知道 编辑:UC知道 时间:2024/05/22 10:28:33
打印输出某年的年历。日历的编排是每400年一个大循环周期,即今年的月、日、星期几和400年前的完全一样。现行天文历法根据天体运行规律,取每年365.2425天。这样,每400年共有365.2425×400=146097天。如果以365天作为一年,每400年就少了0.2425×400=97天。这97天要靠设置闰年(每年366)天来凑齐,所以,每400年要设置97个闰年。
编程要求:按照以上背景知识可得判断闰年得规律:某年年份如果能被4整除但不能被100整除,或者能被400整除则是闰年。由此规则可推得计算万年历的公式:
S=X-1+(X-1)/4-(X-1)/100+(x-1)/400+C 上式中:X为公元年数(如2003年);C 为从元旦起,到要算的那天总数(如2003年3月23日,C=31+28+23=82)。S/7余数是星期几。
参照运行结果:
请输入年份:2007

2007年

1月 日 一 二 三 四 五 六
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31

(以下月份如上) 再次感谢!!!!!

我也不知道

#include<iostream.h>
#include <process.h>
int day_s();
int year_s();
int week_s();
void output_month();
void menu();
void output_year();
int year,month;
void main()
{
cout<<"请输入年月以打印该月日历!"<<endl;
cout<<"年:";
cin>>year;
cout<<"月:";
cin>>month;
system("cls");
cout<<"\t\t"<<"公元"<<year<<"年"<<endl;
output_month();
menu();
}

int day_s()
{
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:return 31;break;
case 4:
case 6:
case 9:
case 11:return 30;break;
case 2:if(year%4==0&&year%100!=0||year%400==0)
return 29;
else return 28;break;

}
}
<