万历算法分析(精品)

万历算法分析(精品)

ID:43611814

大小:712.18 KB

页数:14页

时间:2019-10-11

万历算法分析(精品)_第1页
万历算法分析(精品)_第2页
万历算法分析(精品)_第3页
万历算法分析(精品)_第4页
万历算法分析(精品)_第5页
资源描述:

《万历算法分析(精品)》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、力年历算法一.阳历算法具体算法见隊【数Voidget_solar_day_date(void),这样阳历日历的星期排法就确疋了。表1:月份123456789101112闰年312931303130313130313031非闰年312831303130313130313031变暈定义:Public:Unsignedinttemp_total_day;Unsignedchargc_so1ar_ca1cndar.ycar;Unsignedchargc_so1ar_ca1endar_month;UnsignedcharUnsignedchargc_so1ar_ca1endar_date;

2、gc_lunar_calendar_year;Unsignedchargc_lunar_calendar_month;Unsignedchargc_lunar_ca1cndar_datc;Unsignedcharstart_day_of_week:说明:函数get_solar_day_date(void)的输入变m:gc_solar_calendar_year和gc_so1ar_ca1endar.month输出变量:start_day_of_week和temp_total_dayVoidget_solar_day_date(void)unsignedchartempO1:./*c

3、alculatewhatdayisthedayofthecurrentmonthandyear・Mon^Sun?*//*条件初始化二次,减少运算数据量.temp_total_day是int型变暈*/start_day_of_week=2;temp_total_day=0;calculate_temp=1;if(gc_solar_calendar_year>99){start_day_of_week二6;calculate.temp二100;}for(tempOl=calculate_temp;tempO1

4、empO1%4==0){start_day_of_week+=2;temp_total_day+=366;}else{start_day_of_week+=1;temp_total_day+=365;}}for(tempOl二1;tempO1

5、ndar_year!=200)){start_day_of_week+=1;temp_total_day+=29;}else{start_day_of_wcck+=0:tcmp_total_day+=28;)break;case4,6,9,11:start_day_of_week+二2;temp_total_day+=30;break;}}start_day_of_week%=7;/*-endofcalculatewhatdayistheday(MoiCSun?)andtotalday―*/二、阴历算法200年需要200X2=400个字节,构成阴历压缩数据表1unar_calen

6、dar_month_table[]illb:constcharlunar_calendar_month_table[]={〃从阴历年1900年至!

7、2100年/*thetotaldayofeachmonthpointer*//*from190广2100*//*(0110)110000001001(OllO)leapmonth,110000001001lunarmonthtotalday:1-290:30*/0x00,0x04,Oxad,0x08,0x5a,0x01,0xd5,0x54,0xb4,0x09,0x64,0x05,0x59,0x45,0x95,0x0a,0xa6,0x0

8、4,0x55,0x24,Oxad,0x08,0x5a,0x62,Oxda,0x04,0xb4,0x05,0xb4,0x55,0x52,OxOd,0x94,0x0a,0x4a,0x2a,Ox56,0x02,0x6d,0x71,0x6d,0x01,Oxda,0x02,0xd2,0x52»0xa9,0x05,0x49,OxOd,0x2a,0x45,0x2b,0x09,0x56,0x01,0xb5,0x20,0x6dt0x01,0x59,0x69,0xd4t0x0a,0xa&0x05,0

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。