#include
#include
Unsigned int LunarCalendarDay;
Unsigned int LunarCalendarTable [199]=
{
X5526bd x04ae53 0, 0 x0a5748, 0, 0, x0d2650 x0d9544 0, 0 x46aab9, 0 x056a4d, 0 x09ad42, 0 x24aeb6, 0 x04ae4a,/* */1901-1910
X0d2546 x6a4dbe 0, 0 x0a4d52, 0, 0, x5d52ba x0b544e 0, 0 x0d6a43, 0 x296d37, 0 x095b4b, 0 x749bc1, 0 x049754,/* */1911-1920
X06a550 x0a4b48 0, 0 x5b25bc, 0, 0, x06d445 x4adab8 0, 0 x02b64d, 0 x095742, 0 x2497b7, 0 x04974a, 0 x664b3e,/* */1921-1930
X56d4ba x0d4a51 0, 0 x0ea546, 0, 0, x05ad4e x02b644 0, 0 x393738, 0 x092e4b, 0 x7c96bf, 0 x0c9553, 0 x0d4a48,/* */1931-1940
X056a45 x6da53b 0, 0 x0b554f, 0, 0, x4aadb9 x025d4d 0, 0 x092d42, 0 x2c95b6, 0 x0a954a, 0 x7b4abd, 0 x06ca51,/* */1941-1950
X04da4e x0b5546 0, 0 x555abb, 0, 0, x0a5b43 x352bb8 0, 0 x052b4c, 0 x8a953f, 0 x0e9552, 0 x06aa48, 0 x6ad53c,/* */1951-1960
X4a5739 x0ab54f 0, 0 x04b645, 0, 0, x0a574d x052642 0, 0 x3e9335, 0 x0d9549, 0 x75aabe, 0 x056a51, 0 x096d46,/* */1961-1970
X0a4d43 x54aebb 0, 0 x04ad4f, 0, 0, x4d26b7 x0d254b 0, 0 x8d52bf, 0 x0b5452, 0 x0b6a47, 0 x696d3c, 0 x095b50,/* */1971-1980
X0a4b4d x049b45 0, 0 x4a4bb9, 0, 0, xab25c2 x06a554 0, 0 x06d449, 0 x6ada3d, 0 x0ab651, 0 x093746, 0 x5497bb,/* */1981-1990
X36a537 x04974f 0, 0 x064b44, 0, 0, x0ea54a x86b2bf 0, 0 x05ac53, 0 x0ab647, 0 x5936bc, 0 x092e50, 0 x0c9645,/* */1991-2000
X0da541 x4d4ab8 0, 0 x0d4a4c, 0, 0, x25aab6 x056a49 0, 0 x7aadbd, 0 x025d52, 0 x092d47, 0 x5c95ba, 0 x0a954e,/* */2001-2010
X0ad54a x0b4a43 0, 0 x4b5537, 0, 0, x955abf x04ba53 0, 0 x0a5b48, 0 x652bbc, 0 x052b50, 0 x0a9345, 0 x474ab9,/* */2011-2020
X24dab6 x06aa4c 0, 0 x0ad541, 0, 0, x04b64a x69573d 0, 0 x0a4e51, 0 x0d2646, 0 x5e933a, 0 x0d534d, 0 x05aa43,/* */2021-2030
Xb4aebf x36b537 0, 0 x096d4b, 0, 0, x04ad53 x0a4d48 0, 0 x6d25bc, 0 x0d254f, 0 x0d5244, 0 x5daa38, 0 x0b5a4c,/* */2031-2040
X049b4a x056d41 0, 0 x24adb6, 0, 0, x7a4bbe x0a4b51 0, 0 x0aa546, 0 x5b52ba, 0 x06d24e, 0 x0ada42, 0 x355b37,/* */2041-2050
X049753 x09374b 0, 0 x8497c1, 0, 0, x064b48 x66a53c 0, 0 x0ea54f, 0 x06b244, 0 x4ab638, 0 x0aae4c, 0 x092e42,/* */2051-2060
X7d4abd x3c9735 0, 0 x0c9649, 0, 0, x0d4a51 x0da545 0, 0 x55aaba, 0 x056a4e, 0 x0a6d43, 0 x452eb7, 0 x052d4b,/* */2061-2070
X0b4a47 x8a95bf 0, 0 x0a9553, 0, 0, x6b553b x0ad54f 0, 0 x055a45, 0 x4a5d38, 0 x0a5b4c, 0 x052b42, 0 x3a93b6,/* */2071-2080
X06aa51 x069349 0, 0 x7729bd, 0, 0, x0ad546 x54daba 0, 0 x04b64e, 0 x0a5743, 0 x452738, 0 x0d264a, 0 x8e933e,/* */2081-2090
X66b53b x0d5252 0, 0 x0daa47, 0, 0, x056d4f x04ae45 0, 0 x4a4eb9, 0 x0a4d4c, 0 x0d1541, 0 x2d92b5/* */2091-2099
};
Int MonthAdd [12]=,31,59,90,120,151,181,212,243,273,304,334 {0};
During the int LunarCalendar (int, int the month, int day
{
Int Spring_NY, Sun_NY StaticDayCount;
Int index, flag;
The number of days//Spring_NY records from the Spring Festival New Year's day,
//Sun_NY record New Year's day from the Gregorian calendar days,
If (((LunarCalendarTable] [year - 1901 & amp; 0 x0060) & gt;> 5)==1)
Spring_NY=(LunarCalendarTable] [year - 1901 & amp; 0 x001f) - 1;
The else
Spring_NY=(LunarCalendarTable] [year - 1901 & amp; 0 x001f) - 1 + 31;
Sun_NY=MonthAdd] [the month - 1 + 1 day;
If ((! (year 4) %) & amp; & (the month & gt; 2))
Sun_NY + +;
//StaticDayCount record size on the number of days 29 or 30
//index records from which month start to calculate,
//the flag is used for special processing of leap month,
//determine the Gregorian calendar day before the Spring Festival is the Spring Festival after
If (Sun_NY & gt;=Spring_NY)//the Gregorian calendar days after the Spring Festival (including on the day of the Spring Festival)
{
Sun_NY -=Spring_NY;
The month=1;
The index=1;
flag=0;
If ((LunarCalendarTable] [year - 1901 & amp; (0 x80000 & gt;> (the index - 1)))==0)
StaticDayCount=29;
The else
StaticDayCount=30;
While (Sun_NY & gt;=StaticDayCount)
{
Sun_NY -=StaticDayCount;
Index++;
If (the month==((LunarCalendarTable] [year - 1901 & amp; 0 xf00000) & gt;> 20))
{
Flag=~ flag;
If (flag==0)
Month++;
}
The else
Month++;
If ((LunarCalendarTable] [year - 1901 & amp; (0 x80000 & gt;> (the index - 1)))==0)
StaticDayCount=29;
The else
StaticDayCount=30;
}
Day=Sun_NY + 1;
}
The else//the Gregorian calendar day before the Spring Festival
{
Spring_NY -=Sun_NY;
Year -;
The month=12;
If (((LunarCalendarTable] [year - 1901 & amp; 0 xf00000) & gt;> 20)==0)
The index=12;
The else
The index=13;
flag=0;
If ((LunarCalendarTable] [year - 1901 & amp; (0 x80000 & gt;> (the index - 1)))==0)
StaticDayCount=29;
The else
StaticDayCount=30;
While (Spring_NY & gt; StaticDayCount)
{
Spring_NY -=StaticDayCount;
The index -;
If (flag==0)
The month -;
If (the month==((LunarCalendarTable] [year - 1901 & amp; 0 xf00000) & gt;> 20))
Flag=~ flag;
If ((LunarCalendarTable] [year - 1901 & amp; (0 x80000 & gt;> (the index - 1)))==0)
StaticDayCount=29;
The else
StaticDayCount=30;
}
Day=StaticDayCount Spring_NY + 1;
}
LunarCalendarDay |=day;
LunarCalendarDay |=(the month & lt; <6);
If (the month==((LunarCalendarTable] [year - 1901 & amp; 0 xf00000) & gt;> 20))
return 1;
The else
return 0;
}
The main ()
{
Const char * ChDay []={" * ", "new moon", "2", "grade", "4", "fifth",
"People", "month", "day", "double", "month",
"Eleven", "twelve", "13", 14 ", "15",
"16" and "17", "18", "19", "20",
"21", "22", "23", "24", "25",
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull