# 单片机万年历阴阳历c语言,单片机 阴历阳历c算法 万年历

51单片机万年历优化算法源程序

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；

Void 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; 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;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;}}

• 0
点赞
• 0
收藏
• 0
评论
06-06
04-06
08-03
05-03
07-24
05-23 845
09-30 1万+

### “相关推荐”对你有帮助么？

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、C币套餐、付费专栏及课程。