程序代码:
extern "C" _declspec(dllexport) void n_con_g(WORD LunarY,WORD LunarM,WORD LunarD,WORD &Y,WORD &M,WORD &D)
{
bool flag=n_check(LunarY,LunarM,LunarD);
if (flag==false)
{
Y=0;
M=0;
D=0;
return;
}
int n_days=getalldays(LunarY,LunarM,LunarD);
int g_days=days1800;;
int iyear=0;
for(iyear=1801;iyear<2101;iyear++)
{
if(n_days-g_days>365)
{
g_days+=year_alldays(iyear);
}
else
{
break;
}
}
int imonth,iday;
int g_days2=g_days;
for(imonth=1;imonth<=12;imonth++)
{
if((n_days-g_days)>31)
{
g_days=g_days2+year_sumday(iyear,imonth);
}
else
{
if(imonth==1) imonth++;
break;
}
}
imonth--;
iday=n_days-g_days;
if(iday==0) {iyear--;imonth=12;iday=31;}
Y=iyear;
M=imonth;
D=iday;
}
基本搞定,基本正确,进入软件测试阶段