- 4
- 0
- 约1.12万字
- 约 6页
- 2017-08-22 发布于湖北
- 举报
阴历、阳历算法
一、 阳历算法具体算法见函数Void get_solar_day_date(void),这样阳历日历的星期排法就确定了。表1:月份 1 2 3 4 5 6 7 8 9 10 11 12?闰年 31 29 31 30 31 30 31 31 30 31 30 31?非闰年 31 28 31 30 31 30 31 31 30 31 30 31?变量定义:Public:Unsigned int temp_total_day;Unsigned char gc_solar_calendar_year;Unsigned char gc_solar_calendar_month;Unsigned char gc_solar_calendar_date;Unsigned char gc_lunar_calendar_year;Unsigned char gc_lunar_calendar_month;Unsigned char gc_lunar_calendar_date;Unsigned char start_day_of_week;说明:函数get_solar_day_date(void)的输入变量:gc_solar_calendar_year和gc_solar_calendar_month输出变量:start_day_of_week和temp_total_dayVoid get_solar_day_date(void){unsigned char temp01;/*calculate what day is the day of the current month and year. 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(temp01 = calculate_temp; temp01gc_solar_calendar_year; temp01++){ if(temp01%4 == 0){start_day_of_week +=2;temp_total_day += 366; }else {start_day_of_week +=1;temp_total_day += 365;}}for(temp01 = 1;temp01gc_solar_calendar_month;temp01++){ switch(temp01){case 1,3,5,7,8,10,12: start_day_of_week +=3;temp_total_day +=31;break;case 2: if(((gc_solar_calendar_year%4) == 0)(gc_solar_calendar_year != 200)){start_day_of_week +=1; temp_total_day +=29;}else {start_day_of_week +=0;temp_total_day +=28;} break;case 4,6,9,11: start_day_of_week +=2; temp_total_day +=30; break;}}start_day_of_week %=7;/*-end of calculate what day is the day(Mon~Sun?) and total day --*/}二、 阴历算法200年需要200 × 2 = 400个字节,构成阴历压缩数据表lunar_calendar_month_table[]如下:const char lunar_calendar_month_table[]={ //从阴历年1900年到2100年/*the total day of each month pointer *//* from 1901~2100*//* (0110)110000001001 (0110)leap month,110000001001?lunar month total day: 1:29 0:30*/0x00,0x04,0xad,0x08,0x5a,0x01,0xd5,0x54,0xb4,0x09,0x64,0x05,0x59,0x45, 0x95,0x0a,0xa6,0x04,0x55,0x24,0xad,0x08,0x5a,0x62,0x
您可能关注的文档
- 镇江内江湿地不同演替阶段植物群落小气候日动态.pdf
- 长春一汽富维汽车零部件股份有限公司2010年年度报告摘要.pdf
- 长江源记.docx
- 长江盐度.pdf
- 长沙市一中2013届高三月考.doc
- 长海县代理发表职称论文发表-热力管网阻力平衡调整论文选题题目.docx
- 长源电力:2009年度独立董事述职报告(梅亚东) 2010-04-15.pdf
- 长江中下游地区的矽卡岩交代柱特征与深部找矿.pdf
- 长源电力:2010年半年度报告摘要(更正后) 2010-09-07.pdf
- 长源电力:内部控制鉴证报告 2010-04-15.pdf
- 2026年及未来5年内中国液体氩气行业投资前景及策略咨询研究报告.docx
- 2026年及未来5年内中国黄铜合页行业投资前景及策略咨询研究报告.docx
- 2026年及未来5年内中国竹工艺家具行业投资前景及策略咨询研究报告.docx
- 2025年中国微机数显自动分析仪市场调查研究报告.docx
- 2026年及未来5年内中国微尘白色粉笔行业投资前景及策略咨询研究报告.docx
- 2025年中国微电脑型压胶机市场调查研究报告.docx
- 2026年及未来5年内中国数字化等功游泳训练测试系统行业投资前景及策略咨询研究报告.docx
- 2025年中国圆形花瓶市场调查研究报告.docx
- 2026年及未来5年内中国植物纤维静淀过滤器行业投资前景及策略咨询研究报告.docx
- 2025年中国超音波手套机市场调查研究报告.docx
最近下载
- 平潭澳海上风电场项目可研收口报告2018年4月版本15工程设计概算表.pdf VIP
- 2024年常州信息职业技术学院单招职业技能测试题库(历年真题).docx VIP
- 腹膜透析指南(2025年版).docx VIP
- 党的二十届四中全会PPT课件.ppt VIP
- 产品设计与实训 设计实训.ppt VIP
- 施工现场建筑垃圾减量化专项方案.pdf VIP
- 《数学史》数学的起源.pptx VIP
- 2026年信息科技课标试题及答案.doc VIP
- 本科课件-ArcGIS Engine地理信息系统开发教程(完整).ppt
- 北京通州区2022-2023学年高一下学期期末质量检测英语试卷 含解析.docx VIP
原创力文档

文档评论(0)