我来改造个公历转换农历的算法
本帖最后由 lswhome 于 2014-5-26 04:07 编辑也是抄别人的,但我简单改造过了,参数都是10进制的。
static UINT8 code year_code={
0x04,0xAe,0x53,0x0A,0x57,0x48,0x55,0x26,0xBd, // 1901-1903
0x0d,0x26,0x50,0x0d,0x95,0x44,0x46,0xAA,0xB9, // 1904-1906
0x05,0x6A,0x4d,0x09,0xAd,0x42,0x24,0xAe,0xB6, // 1907-1909
0x04,0xAe,0x4A,0x6A,0x4d,0xBe,0x0A,0x4d,0x52, // 1910-1912
0x0d,0x25,0x46,0x5d,0x52,0xBA,0x0B,0x54,0x4e, // 1913-1915
0x0d,0x6A,0x43,0x29,0x6d,0x37,0x09,0x5B,0x4B, // 1916-1918
0x74,0x9B,0xC1,0x04,0x97,0x54,0x0A,0x4B,0x48, // 1919-1921
0x5B,0x25,0xBC,0x06,0xA5,0x50,0x06,0xd4,0x45, // 1922-1924
0x4A,0xdA,0xB8,0x02,0xB6,0x4d,0x09,0x57,0x42, // 1925-1927
0x24,0x97,0xB7,0x04,0x97,0x4A,0x66,0x4B,0x3e, // 1928-1930
0x0d,0x4A,0x51,0x0e,0xA5,0x46,0x56,0xd4,0xBA, // 1931-1933
0x05,0xAd,0x4e,0x02,0xB6,0x44,0x39,0x37,0x38, // 1934-1936
0x09,0x2e,0x4B,0x7C,0x96,0xBf,0x0C,0x95,0x53, // 1937-1939
0x0d,0x4A,0x48,0x6d,0xA5,0x3B,0x0B,0x55,0x4f, // 1940-1942
0x05,0x6A,0x45,0x4A,0xAd,0xB9,0x02,0x5d,0x4d, // 1943-1945
0x09,0x2d,0x42,0x2C,0x95,0xB6,0x0A,0x95,0x4A, // 1946-1948
0x7B,0x4A,0xBd,0x06,0xCA,0x51,0x0B,0x55,0x46, // 1949-1951
0x55,0x5A,0xBB,0x04,0xdA,0x4e,0x0A,0x5B,0x43, // 1952-1954
0x35,0x2B,0xB8,0x05,0x2B,0x4C,0x8A,0x95,0x3f, // 1955-1957
0x0e,0x95,0x52,0x06,0xAA,0x48,0x7A,0xd5,0x3C, // 1958-1960
0x0A,0xB5,0x4f,0x04,0xB6,0x45,0x4A,0x57,0x39, // 1961-1963
0x0A,0x57,0x4d,0x05,0x26,0x42,0x3e,0x93,0x35, // 1964-1966
0x0d,0x95,0x49,0x75,0xAA,0xBe,0x05,0x6A,0x51, // 1967-1969
0x09,0x6d,0x46,0x54,0xAe,0xBB,0x04,0xAd,0x4f, // 1970-1972
0x0A,0x4d,0x43,0x4d,0x26,0xB7,0x0d,0x25,0x4B, // 1973-1975
0x8d,0x52,0xBf,0x0B,0x54,0x52,0x0B,0x6A,0x47, // 1976-1978
0x69,0x6d,0x3C,0x09,0x5B,0x50,0x04,0x9B,0x45, // 1979-1981
0x4A,0x4B,0xB9,0x0A,0x4B,0x4d,0xAB,0x25,0xC2, // 1982-1984
0x06,0xA5,0x54,0x06,0xd4,0x49,0x6A,0xdA,0x3d, // 1985-1987
0x0A,0xB6,0x51,0x09,0x37,0x46,0x54,0x97,0xBB, // 1988-1990
0x04,0x97,0x4f,0x06,0x4B,0x44,0x36,0xA5,0x37, // 1991-1993
0x0e,0xA5,0x4A,0x86,0xB2,0xBf,0x05,0xAC,0x53, // 1994-1996
0x0A,0xB6,0x47,0x59,0x36,0xBC,0x09,0x2e,0x50, // 1997-1999
0x0C,0x96,0x45,0x4d,0x4A,0xB8,0x0d,0x4A,0x4C, // 2000-2002
0x0d,0xA5,0x41,0x25,0xAA,0xB6,0x05,0x6A,0x49, // 2003-2005
0x7A,0xAd,0xBd,0x02,0x5d,0x52,0x09,0x2d,0x47, // 2006-2008
0x5C,0x95,0xBA,0x0A,0x95,0x4e,0x0B,0x4A,0x43, // 2009-2011
0x4B,0x55,0x37,0x0A,0xd5,0x4A,0x95,0x5A,0xBf, // 2012-2014
0x04,0xBA,0x53,0x0A,0x5B,0x48,0x65,0x2B,0xBC, // 2015-2017
0x05,0x2B,0x50,0x0A,0x93,0x45,0x47,0x4A,0xB9, // 2018-2020
0x06,0xAA,0x4C,0x0A,0xd5,0x41,0x24,0xdA,0xB6, // 2021-2023
0x04,0xB6,0x4A,0x69,0x57,0x3d,0x0A,0x4e,0x51, // 2024-2026
0x0d,0x26,0x46,0x5e,0x93,0x3A,0x0d,0x53,0x4d, // 2027-2029
0x05,0xAA,0x43,0x36,0xB5,0x37,0x09,0x6d,0x4B, // 2030-2032
0xB4,0xAe,0xBf,0x04,0xAd,0x53,0x0A,0x4d,0x48, // 2033-2035
0x6d,0x25,0xBC,0x0d,0x25,0x4f,0x0d,0x52,0x44, // 2036-2038
0x5d,0xAA,0x38,0x0B,0x5A,0x4C,0x05,0x6d,0x41, // 2039-2041
0x24,0xAd,0xB6,0x04,0x9B,0x4A,0x7A,0x4B,0xBe, // 2042-2044
0x0A,0x4B,0x51,0x0A,0xA5,0x46,0x5B,0x52,0xBA, // 2045-2047
0x06,0xd2,0x4e,0x0A,0xdA,0x42,0x35,0x5B,0x37, // 2048-2050
0x09,0x37,0x4B,0x84,0x97,0xC1,0x04,0x97,0x53, // 2051-2053
0x06,0x4B,0x48,0x66,0xA5,0x3C,0x0e,0xA5,0x4f, // 2054-2056
0x06,0xB2,0x44,0x4A,0xB6,0x38,0x0A,0xAe,0x4C, // 2057-2059
0x09,0x2e,0x42,0x3C,0x97,0x35,0x0C,0x96,0x49, // 2060-2062
0x7d,0x4A,0xBd,0x0d,0x4A,0x51,0x0d,0xA5,0x45, // 2063-2065
0x55,0xAA,0xBA,0x05,0x6A,0x4e,0x0A,0x6d,0x43, // 2066-2068
0x45,0x2e,0xB7,0x05,0x2d,0x4B,0x8A,0x95,0xBf, // 2069-2071
0x0A,0x95,0x53,0x0B,0x4A,0x47,0x6B,0x55,0x3B, // 2072-2074
0x0A,0xd5,0x4f,0x05,0x5A,0x45,0x4A,0x5d,0x38, // 2075-2077
0x0A,0x5B,0x4C,0x05,0x2B,0x42,0x3A,0x93,0xB6, // 2078-2080
0x06,0x93,0x49,0x77,0x29,0xBd,0x06,0xAA,0x51, // 2081-2083
0x0A,0xd5,0x46,0x54,0xdA,0xBA,0x04,0xB6,0x4e, // 2084-2086
0x0A,0x57,0x43,0x45,0x27,0x38,0x0d,0x26,0x4A, // 2087-2089
0x8e,0x93,0x3e,0x0d,0x52,0x52,0x0d,0xAA,0x47, // 2090-2092
0x66,0xB5,0x3B,0x05,0x6d,0x4f,0x04,0xAe,0x45, // 2093-2095
0x4A,0x4e,0xB9,0x0A,0x4d,0x4C,0x0d,0x15,0x41, // 2096-2098
0x2d,0x92,0xB5, // 2099
};
//月份天数数据表
static UINT8 code day_code1={0x0,0x1f,0x3b,0x5a,0x78,0x97,0xb5,0xd4,0xf3};
static UINT16 code day_code2={0x111,0x130,0x14e};
static bit Get_Moon_Day(UINT8 month_p,UINT16 code_addr) //读取数据表中农历月的大月或小月,如果该月大返回1,小返回0*/
{
UINT8 xdata temp,temp1;
temp1=(month_p+3)/8;
temp=0x80>>((month_p+3)%8);
temp=year_code&temp;
if(temp==0){return(0);}else{return(1);}
}
extern void GetLunar(UINT16 year_src,UINT8 month,UINT8 day,UINT16 *Year,UINT8 *Month,UINT8 *Day,UINT8 *MonthDay)
{
UINT8 xdata temp1,temp2,temp3,month_p,year;
UINT16 xdata temp4,code_addr,year_tmp;
bit flag2,flag_y;
UINT8 xdata year_h,year_l;
year_tmp=year_src;
year_h=year_src/100; year_l=year_src%100; //求出高位和低位
year=year_l;
code_addr=year-1; //定位数据表地址
if(year_h>19)code_addr+=0x64;
code_addr*=3;
temp1=year_code&0x60; //取当年春节所在的公历月份
temp1=_cror_(temp1,5);
temp2=year_code&0x1f; //取当年春节所在的公历日
temp3=temp2-1; //计算当年春节离当年元旦的天数,春节只会在公历1月或2月
if(temp1!=1)temp3+=0x1f;
if(month<10)
{
temp4=day_code1+day-1;
}
else
{
temp4=day_code2+day-1;
}
if((month>2)&&(year%0x04==0))temp4+=1; //如果公历月小于2月或者该年的2月非闰月,天数减1
if (temp4>=temp3) //判断公历日在春节前还是春节后
{
//公历日在春节后或就是春节当日使用下面代码进行运算
temp4 -=temp3;
month= 1;
flag_y = 0;
month_p= 1;//month_p为月份指向,公历日在春节前或就是春节当日month_p指向首月
flag2=Get_Moon_Day(month_p,code_addr); //检查该农历月为大小还是小月,大月返回1,小月返回0
if(flag2==0){temp1=29;}else{temp1=30;} //小月29天、大月30天
temp2=year_code&0xf0;
temp2=_cror_(temp2,4);//从数据表中取该年的闰月月份,如为0则该年无闰月
while(temp4>=temp1)
{
temp4-=temp1;
month_p+=1;
if(month==temp2)
{
flag_y=~flag_y;
if(flag_y==0)month+=1;
}
else month+=1;
flag2=Get_Moon_Day(month_p,code_addr);
if(flag2==0)temp1=0x1d;
else temp1=0x1e;
}
day=temp4+1;
}
else
{
//公历日在春节前使用下面代码进行运算
temp3-=temp4;
if(year==0){year=99;year_h=19;}else{year-=1;}
code_addr-=3;
month= 0x0c;
temp2= year_code&0xf0;
temp2= _cror_(temp2,4);
flag_y = 0;
if(temp2==0){month_p=12;}else{month_p=13;} //如果当年有闰月,一年有十三个月,月指向13,无闰月指向12
flag2=Get_Moon_Day(month_p,code_addr);
if(flag2==0){temp1=29;}else{temp1=30;}
while(temp3>temp1)
{
temp3-=temp1;
month_p-=1;
if(flag_y==0)month-=1;
if(month==temp2)flag_y=~flag_y;
flag2=Get_Moon_Day(month_p,code_addr);
if(flag2==0){temp1=0x1d;}else{temp1=0x1e;}
}
day=temp1-temp3+1;
}
*MonthDay=temp1;//农历的天数
*Year =((UINT16)year_h*100)+(UINT16)year; //将农历信息写进指定变量
*Month = month;
*Day = day;
}
{:victory:}{:victory:}{:victory:}{:victory:}{:victory:}{:victory:} 谢谢,试试 感谢分享!保存了! 谢谢分享 好 谢谢分享,收下了 不错哈,能到2099年。我之前找的一个只能做到2049年。 火钳刘明 不错,就是表格有点大. wenunit 发表于 2014-5-26 09:25
不错,就是表格有点大.
那就继续把1901-1999的给砍掉,我之前在avr上就是这样改的. 感谢,觉得有用就好,不然又要浪费阿莫的资源了。 把你的这段程序弄到vc上试了下,可以
试到2050年ok网上的万年历都直到2050就没有了 再往后就没法测了
// test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;
typedef unsigned int bit;
static UINT8year_code={
0x04,0xAe,0x53,0x0A,0x57,0x48,0x55,0x26,0xBd, // 1901-1903
0x0d,0x26,0x50,0x0d,0x95,0x44,0x46,0xAA,0xB9, // 1904-1906
0x05,0x6A,0x4d,0x09,0xAd,0x42,0x24,0xAe,0xB6, // 1907-1909
0x04,0xAe,0x4A,0x6A,0x4d,0xBe,0x0A,0x4d,0x52, // 1910-1912
0x0d,0x25,0x46,0x5d,0x52,0xBA,0x0B,0x54,0x4e, // 1913-1915
0x0d,0x6A,0x43,0x29,0x6d,0x37,0x09,0x5B,0x4B, // 1916-1918
0x74,0x9B,0xC1,0x04,0x97,0x54,0x0A,0x4B,0x48, // 1919-1921
0x5B,0x25,0xBC,0x06,0xA5,0x50,0x06,0xd4,0x45, // 1922-1924
0x4A,0xdA,0xB8,0x02,0xB6,0x4d,0x09,0x57,0x42, // 1925-1927
0x24,0x97,0xB7,0x04,0x97,0x4A,0x66,0x4B,0x3e, // 1928-1930
0x0d,0x4A,0x51,0x0e,0xA5,0x46,0x56,0xd4,0xBA, // 1931-1933
0x05,0xAd,0x4e,0x02,0xB6,0x44,0x39,0x37,0x38, // 1934-1936
0x09,0x2e,0x4B,0x7C,0x96,0xBf,0x0C,0x95,0x53, // 1937-1939
0x0d,0x4A,0x48,0x6d,0xA5,0x3B,0x0B,0x55,0x4f, // 1940-1942
0x05,0x6A,0x45,0x4A,0xAd,0xB9,0x02,0x5d,0x4d, // 1943-1945
0x09,0x2d,0x42,0x2C,0x95,0xB6,0x0A,0x95,0x4A, // 1946-1948
0x7B,0x4A,0xBd,0x06,0xCA,0x51,0x0B,0x55,0x46, // 1949-1951
0x55,0x5A,0xBB,0x04,0xdA,0x4e,0x0A,0x5B,0x43, // 1952-1954
0x35,0x2B,0xB8,0x05,0x2B,0x4C,0x8A,0x95,0x3f, // 1955-1957
0x0e,0x95,0x52,0x06,0xAA,0x48,0x7A,0xd5,0x3C, // 1958-1960
0x0A,0xB5,0x4f,0x04,0xB6,0x45,0x4A,0x57,0x39, // 1961-1963
0x0A,0x57,0x4d,0x05,0x26,0x42,0x3e,0x93,0x35, // 1964-1966
0x0d,0x95,0x49,0x75,0xAA,0xBe,0x05,0x6A,0x51, // 1967-1969
0x09,0x6d,0x46,0x54,0xAe,0xBB,0x04,0xAd,0x4f, // 1970-1972
0x0A,0x4d,0x43,0x4d,0x26,0xB7,0x0d,0x25,0x4B, // 1973-1975
0x8d,0x52,0xBf,0x0B,0x54,0x52,0x0B,0x6A,0x47, // 1976-1978
0x69,0x6d,0x3C,0x09,0x5B,0x50,0x04,0x9B,0x45, // 1979-1981
0x4A,0x4B,0xB9,0x0A,0x4B,0x4d,0xAB,0x25,0xC2, // 1982-1984
0x06,0xA5,0x54,0x06,0xd4,0x49,0x6A,0xdA,0x3d, // 1985-1987
0x0A,0xB6,0x51,0x09,0x37,0x46,0x54,0x97,0xBB, // 1988-1990
0x04,0x97,0x4f,0x06,0x4B,0x44,0x36,0xA5,0x37, // 1991-1993
0x0e,0xA5,0x4A,0x86,0xB2,0xBf,0x05,0xAC,0x53, // 1994-1996
0x0A,0xB6,0x47,0x59,0x36,0xBC,0x09,0x2e,0x50, // 1997-1999
0x0C,0x96,0x45,0x4d,0x4A,0xB8,0x0d,0x4A,0x4C, // 2000-2002
0x0d,0xA5,0x41,0x25,0xAA,0xB6,0x05,0x6A,0x49, // 2003-2005
0x7A,0xAd,0xBd,0x02,0x5d,0x52,0x09,0x2d,0x47, // 2006-2008
0x5C,0x95,0xBA,0x0A,0x95,0x4e,0x0B,0x4A,0x43, // 2009-2011
0x4B,0x55,0x37,0x0A,0xd5,0x4A,0x95,0x5A,0xBf, // 2012-2014
0x04,0xBA,0x53,0x0A,0x5B,0x48,0x65,0x2B,0xBC, // 2015-2017
0x05,0x2B,0x50,0x0A,0x93,0x45,0x47,0x4A,0xB9, // 2018-2020
0x06,0xAA,0x4C,0x0A,0xd5,0x41,0x24,0xdA,0xB6, // 2021-2023
0x04,0xB6,0x4A,0x69,0x57,0x3d,0x0A,0x4e,0x51, // 2024-2026
0x0d,0x26,0x46,0x5e,0x93,0x3A,0x0d,0x53,0x4d, // 2027-2029
0x05,0xAA,0x43,0x36,0xB5,0x37,0x09,0x6d,0x4B, // 2030-2032
0xB4,0xAe,0xBf,0x04,0xAd,0x53,0x0A,0x4d,0x48, // 2033-2035
0x6d,0x25,0xBC,0x0d,0x25,0x4f,0x0d,0x52,0x44, // 2036-2038
0x5d,0xAA,0x38,0x0B,0x5A,0x4C,0x05,0x6d,0x41, // 2039-2041
0x24,0xAd,0xB6,0x04,0x9B,0x4A,0x7A,0x4B,0xBe, // 2042-2044
0x0A,0x4B,0x51,0x0A,0xA5,0x46,0x5B,0x52,0xBA, // 2045-2047
0x06,0xd2,0x4e,0x0A,0xdA,0x42,0x35,0x5B,0x37, // 2048-2050
0x09,0x37,0x4B,0x84,0x97,0xC1,0x04,0x97,0x53, // 2051-2053
0x06,0x4B,0x48,0x66,0xA5,0x3C,0x0e,0xA5,0x4f, // 2054-2056
0x06,0xB2,0x44,0x4A,0xB6,0x38,0x0A,0xAe,0x4C, // 2057-2059
0x09,0x2e,0x42,0x3C,0x97,0x35,0x0C,0x96,0x49, // 2060-2062
0x7d,0x4A,0xBd,0x0d,0x4A,0x51,0x0d,0xA5,0x45, // 2063-2065
0x55,0xAA,0xBA,0x05,0x6A,0x4e,0x0A,0x6d,0x43, // 2066-2068
0x45,0x2e,0xB7,0x05,0x2d,0x4B,0x8A,0x95,0xBf, // 2069-2071
0x0A,0x95,0x53,0x0B,0x4A,0x47,0x6B,0x55,0x3B, // 2072-2074
0x0A,0xd5,0x4f,0x05,0x5A,0x45,0x4A,0x5d,0x38, // 2075-2077
0x0A,0x5B,0x4C,0x05,0x2B,0x42,0x3A,0x93,0xB6, // 2078-2080
0x06,0x93,0x49,0x77,0x29,0xBd,0x06,0xAA,0x51, // 2081-2083
0x0A,0xd5,0x46,0x54,0xdA,0xBA,0x04,0xB6,0x4e, // 2084-2086
0x0A,0x57,0x43,0x45,0x27,0x38,0x0d,0x26,0x4A, // 2087-2089
0x8e,0x93,0x3e,0x0d,0x52,0x52,0x0d,0xAA,0x47, // 2090-2092
0x66,0xB5,0x3B,0x05,0x6d,0x4f,0x04,0xAe,0x45, // 2093-2095
0x4A,0x4e,0xB9,0x0A,0x4d,0x4C,0x0d,0x15,0x41, // 2096-2098
0x2d,0x92,0xB5, // 2099
};
//月份天数数据表
static UINT8day_code1={0x0,0x1f,0x3b,0x5a,0x78,0x97,0xb5,0xd4,0xf3};
static UINT16day_code2={0x111,0x130,0x14e};
static bit Get_Moon_Day(UINT8 month_p,UINT16 code_addr) //读取数据表中农历月的大月或小月,如果该月大返回1,小返回0*/
{
UINT8temp,temp1;
temp1=(month_p+3)/8;
temp=0x80>>((month_p+3)%8);
temp=year_code&temp;
if(temp==0){return(0);}else{return(1);}
}
unsigned int rotate_right(unsigned int x, int n)
{
int save;
int i;
for(i=0;i<n;i++)
{
save=x&0x00000001;
x=x>>1;
save=save<<7;
x+=save;
}
return x;
}
extern void GetLunar(UINT16 year_src,UINT8 month,UINT8 day,UINT16 *Year,UINT8 *Month,UINT8 *Day,UINT8 *MonthDay)
{
UINT8temp1,temp2,temp3,month_p,year;
UINT16temp4,code_addr,year_tmp;
bit flag2,flag_y;
UINT8year_h,year_l;
year_tmp=year_src;
year_h=year_src/100; year_l=year_src%100; //求出高位和低位
year=year_l;
code_addr=year-1; //定位数据表地址
if(year_h>19)code_addr+=0x64;
code_addr*=3;
temp1=year_code&0x60; //取当年春节所在的公历月份
temp1=rotate_right(temp1,5);
temp2=year_code&0x1f; //取当年春节所在的公历日
temp3=temp2-1; //计算当年春节离当年元旦的天数,春节只会在公历1月或2月
if(temp1!=1)temp3+=0x1f;
if(month<10)
{
temp4=day_code1+day-1;
}
else
{
temp4=day_code2+day-1;
}
if((month>2)&&(year%0x04==0))temp4+=1; //如果公历月小于2月或者该年的2月非闰月,天数减1
if (temp4>=temp3) //判断公历日在春节前还是春节后
{
//公历日在春节后或就是春节当日使用下面代码进行运算
temp4 -=temp3;
month= 1;
flag_y = 0;
month_p= 1;//month_p为月份指向,公历日在春节前或就是春节当日month_p指向首月
flag2=Get_Moon_Day(month_p,code_addr); //检查该农历月为大小还是小月,大月返回1,小月返回0
if(flag2==0){temp1=29;}else{temp1=30;} //小月29天、大月30天
temp2=year_code&0xf0;
temp2=rotate_right(temp2,4);//从数据表中取该年的闰月月份,如为0则该年无闰月
while(temp4>=temp1)
{
temp4-=temp1;
month_p+=1;
if(month==temp2)
{
flag_y=~flag_y;
if(flag_y==0)month+=1;
}
else month+=1;
flag2=Get_Moon_Day(month_p,code_addr);
if(flag2==0)temp1=0x1d;
else temp1=0x1e;
}
day=temp4+1;
}
else
{
//公历日在春节前使用下面代码进行运算
temp3-=temp4;
if(year==0){year=99;year_h=19;}else{year-=1;}
code_addr-=3;
month= 0x0c;
temp2= year_code&0xf0;
temp2= rotate_right(temp2,4);
flag_y = 0;
if(temp2==0){month_p=12;}else{month_p=13;} //如果当年有闰月,一年有十三个月,月指向13,无闰月指向12
flag2=Get_Moon_Day(month_p,code_addr);
if(flag2==0){temp1=29;}else{temp1=30;}
while(temp3>temp1)
{
temp3-=temp1;
month_p-=1;
if(flag_y==0)month-=1;
if(month==temp2)flag_y=~flag_y;
flag2=Get_Moon_Day(month_p,code_addr);
if(flag2==0){temp1=0x1d;}else{temp1=0x1e;}
}
day=temp1-temp3+1;
}
*MonthDay=temp1;//农历的天数
*Year =((UINT16)year_h*100)+(UINT16)year; //将农历信息写进指定变量
*Month = month;
*Day = day;
}
int main(int argc, char* argv[])
{
UINT16 year;
UINT8 mon,day,monday;
UINT16 y;
UINT8 m,d;
while(1)
{
printf("please input date\r\n");
scanf("%d%d%d",&y,&m,&d);
printf("intput date is %d-%d-%d\r\n",y,m,d);
GetLunar(y,m,d,&year,&mon,&day,&monday);
printf("output date is %d-%d-%d,%d\r\n",year,mon,day,monday);
}
return 0;
}
这个计算思路不错
果然高手,表示VC不会玩。。。呵呵 谢谢楼主,收藏保存备用了 不错不错,感谢分享 不明觉厉,跪了 楼主 用你程序发现在2028年7月22日出现问题,当年有闰5月7.22应该是6月初一,但是转换出来仍然是5.1 经测试2028年7.22以后农历月份都是5月估计数组有问题 收藏学习之
页:
[1]