初入编程之道的学子大都试编过万年历。万年历有二种:一为只有西历的月历,另一为有农历对照的月历或日历。编写万年历程序可以练练手,加深对编程语言的理解。记得我初入此道是在1994年,我那时刚买了486电脑,也刚开始有视窗的windows3.2系统,很酷的。那时的编程语言有汇编语言,C语言,Basic语言等。我选择了比较好理解的Basic语言,那时流行的是QBasic。编写的万年历程序是屏幕黑白输出的西历的月历。现在的学子用C语言也在编写这种东西。
后来微软在win32中推出了VBiasic3.0,一上手如获至宝。用它可以编写win系统的应用软件,直接编译为EXE软件,还可做成安装版。我也编制过自己喜欢的各种电脑应用程序。再后来微软公司把VBasic升级到4.0和5.0版本,最后升级到6.0版本。就是现在的终极版。这东西还可以,编译一些自己的应用软件作为自己电脑的工具软件。我曾经用它编译过很实用的万年历软件,时间跨度公元前1600年到公元3000年。主要有农历对照,有农历编年,有阴历查询功能,直接显示阴历月历。可用于历史考古研究的时间对照。我在本站上传过win版资源,需要的可下载使用。
本人认为编程语言只是编程工具而已。程序的应用才是目的。如是Windows的电脑系统应用,用VC,VB最好,直接对系统接地气。跨平台的网络应用就可用JAVA和一些新的编程语言。好用,能达到目的就可。这叫为达目的可不择手段。对于目的的应用程序的核心是算法,算法对各种语言是一种思路,用编程语言编写代码就是算法的表达。
我编写万年历课题的几个过程:
一、只有西历的月历 如何在屏幕或画布上定位显示,星期的算法
二、加入阴历对照 显示阴历的算法,对照,定位显示
三、加入节气节假日 完成像样的台历式月历显示
四、加入农历干支生肖 较完善的台历显示,win平台迷你透明桌面台历
五、日历式显示 有寒天九九,暑日三伏,入梅出梅
六、生辰八字查询 完整显示生辰八字,五星,二十八宿,十二建,五行纳音
七、节气交节时刻计算 精确时刻计算难度较高,减精度的简易算法,数据法
八、阴历查询应用软件 完整的win 平台exe 历史考古研究用应用软件
上面就是我的学习编制万年历的过程,由易而难,循序渐进,收获满满,今吐谈
吐槽,为新进的学子提供一些帮助。
本文目的为大家列出编制有农历对照的万年历的一些要素,以及设置这些要素的算法,还有图形界面的绘制方法,供初学者参考。
编制万年历的要素:农历公历对照,显示星期,农历干支年,当年生肖,国定节假日,寒天九九,暑日三伏,入梅出梅,节气时间,生辰八字等。
二种显示方式:一种是日历当天或所选日显示(生辰八字查询),另一种是类似台历的月历显示。
农历算法采用数据数组方法,200年日历数据量不大。程序启动时读入即可。
数据结构18位,如daList[2000]="110010010110000205"; 前12位表示正月到腊月大小月,1为农历大月30天,0为小月29天。 第13,14位表示农历闰月,13位为农历闰月大小,14位为闰几月,
后4位表示农历年首个朔日,即俗称的正月初一的公历日期,2月5日。
节气交节时刻计算,天文算法很精准,但太复杂,数据数组方法数据量太大,都不合适。如要求精确时间,可用数据数组方法。本程序采用曾次亮先生的算法,算法简单,但精度差些。如要精准度就采用数据数组方法,200年的数据量还可以,现在存储和内存容量都较大。我已编译了数据,需要的可索取。
台历式显示月历是公历和农历格式化打印,7天一星期打印输出。农历显示包括初一改为那个月,是节气日期改为节气名称,法定节假日显示。节假日既然是国家法定的,那就应从1949年开始显示。其实各节日哪时开始要考证,故且从权统一从1949年开始。此前也就只显示传统节日。
月历和按天日历都显示当月节气中气时间,同时显示指定查询日生辰八字。
生辰八字显示年月日六字加另列出的时辰二字。
另外还显示日八字的五行二十八宿十二建的排列字,如:甲寅 大溪水胃满 。
八字都有显示五行纳音,如:甲子 海中金 。
民间有俗称今年是金猪年金猴年。其实要看年柱的五行,如:
1984年:甲子 海中金 就是金鼠年
八字年柱月柱算法有二种,此程序采用较通用的,即年柱以立春日启算,月柱以月首节气日启算。
这里有五行纳音,二十八宿,十二建的算法。程序中有注释供同好参考。
生辰八字查询显示是日的各项信息,另加寒日九九,暑日三伏,入梅出梅信息。
本万年历适应用范围(1900-2100),用图形方法绘出,可加贴底图,可屏幕截图保存图片,共享图片,添加图片输出和打印输出功能。贴图的图片起个文件名放在手机根目录就会自动更换。若要编制年份跨期长的万年历,可向我索取数据资料。我有(B.C.850-3000)的daList(3000)阴历数据。另外还有精确的节气时间数据 jqdata ( 3000 ) 。
下面的代码是用简单的C语言写的,很简洁,适用于初学者。我是在安卓手机上编写的,显示是手机界面。
( 代码中print...是算法测试用,这是我的测试方法,已注释掉 )
//************************************
//* 万年历 (1900-2100) V. 1.5.2
//* MySpringC v.2.7 编译
//* 编制:张纯叔(micelu@126.com)
//************************************
Canvas cs; //画布
string sBarDes[10];
int nBarId[10];
float src[4]; //ClearDraw (cls) clear screen
FileInput filebox;
string fname; //filename
int dy,dm,dd;
int wd; //weekday
int alln,alln1;
int i,k,ns,leap;
double nleap,nleapd; //农历闰月,0无闰,闰月大小
int n,n0,n1;
string s,s0,ss,s5;
string s1,s2,s3,s4;
string wds,wdss; //weekday
float x0,y0,x1,y1;
float sx,sy;
string daList[2200];
double dy0,dy1,dm1,dd1;
string dy2,dm2,dd2;
double hh1,mm1,ss1;
string hh2,mm2,ss2;
double jn; //jnum
string jname1,jname2;
string jqnames;
string jz60s;
double jd;
double juD,tht,yrD;
double sD; //shouD
double vs,dalt; //solar
string das0,das1,das2; // 0 last yy, 1 this yy, 2 new
double ysm,ysd; //年首月,年首日
int msd[12]; //月朔日
int msd0,msd1;
string nlms,nlds; //农历月$,农历日$
string getms,getds; //for print nlm$,nldd$
string gms0,gms1;
string gzs,ggzs; //干支
int gzn;
string sxs,gsxs; //生肖
int sxn;
int jqdn,jqd1,jqd2; //print solar day ( calendar )
string jqs1,jqs2;
string jqss1,jqss2;
string bds;
int gzy,gzm,gzd,gzh; //干支 yy mm dd hh
string gzys,gzms,gzds,gzhs;
int gzn1;
int yz,mz; //年柱 月柱
string bzs; //八字
string whss,g12ss,st28ss; //五行 十二建 二十八宿
int dzd0,dzd1; //冬至日 计算九九
int fmn,mn,fn; //母亲节父亲节
int isdraw;
int setc; //set day color in red
main(){
setTitle ("万年历 (1900-2100)");
jqnames="小寒大寒立春雨水惊蛰春分清明谷雨立夏小满芒种夏至小暑大暑立秋处暑白露秋分寒露霜降立冬小雪大雪冬至";
nlds="初一初二初三初四初五初六初七初八初九初十十一十二十三十四十五十六十七十八十九二十廿一廿二廿三廿四廿五廿六廿七廿八廿九三十初一初二初三";
wdss="星期日星期一星期二星期三星期四星期五星期六 ";
nlms="冬月腊月正月二月三月四月五月六月七月八月九月十月冬月腊月";
gzs="甲子乙丑丙寅丁卯戊辰己巳庚午辛未壬申癸酉甲戌乙亥丙子丁丑戊寅己卯庚辰辛己壬午癸未甲申乙酉丙戌丁亥戊子己丑庚寅辛卯壬辰癸巳甲午乙未丙申丁酉戊戌己亥庚子辛丑壬寅癸卯甲辰乙巳丙午丁未戊申己酉庚戌辛亥壬子癸丑甲寅乙卯丙辰丁巳戊午己未庚申辛酉壬戌癸亥";
sxs="鼠牛虎兔龙蛇马羊猴鸡狗猪";
whss="海中金炉中火大林木路旁土剑锋金山头火洞下水城墙土白腊金杨柳木泉中水屋上土霹雷火松柏木长流水沙中金山下火平地木壁上土金箔金佛灯火天河水大驿土钗钏金桑松木大溪水沙中土天上火石榴木大海水";
g12ss="建除满平定执破危成收开闭";
st28ss="角亢氐房心尾箕斗牛女虚危室壁奎娄胃昴毕觜参井鬼柳星张翼轸";
setDisplay (1);
cs.Active ();
sBarDes[0]="输入日期";
nBarId[0]=100;
sBarDes[1]="显示月历";
nBarId[1]=101;
sBarDes[2]="生辰八字";
nBarId[2]=102;
sBarDes[3]="八字起时";
nBarId[3]=103;
sBarDes[4]="退出程序";
nBarId[4]=104;
sBarDes[5]="📲";
nBarId[5]=105;
setToolBarHeight(10);
setButtonTextSize(13);
setToolBarBackgroundColor(255,192,192,192);
setButtonColor(255,0,0,190);
setButtonTextColor(255,255,245,0);
setToolBar(100,myToolBarProc,sBarDes,nBarId,6);
readDat (); //read calendar data 1900-2100
// getWeekday();
//calendar(); //show calendar
isdraw=0;
drawcover ();
while (){}
}//main ()
drawcover (){
cs.SetTextStyle (1);
cs.SetFillMode(1);
cs.SetStrokeWidth(2);
cs.SetColor(255,0,0,128);
cs.DrawRect (6,6,713,1029);
cs.SetColor(255,255,255,255);
cs.DrawRect (65,80,190,600);
cs.SetColor(255,0,0,128);
cs.DrawRect (75,94,180,106);
cs.SetColor(255,0,0,0);
cs.SetTextSize (90);
cs.DrawText ("萬",85,200);
cs.DrawText ("年",85,320);
cs.DrawText ("曆",85,440);
cs.SetColor(255,255,0,0);
cs.SetTextSize(18);
cs.DrawText ("1900",107,510);
cs.DrawText ("2100",107,530);
cs.SetFillMode(0);
cs.DrawRect (108,493,147,535);
cs.SetColor(255,0,0,128);
cs.DrawRect (75,90,180,590);
for (i=0;i<40;i++){
cs.DrawLine (75,589,180,550+i);
cs.DrawLine (75,i+550,180,589);}
cs.SetColor(255,255,255,5);
cs.DrawLine (620,6,620,1029);
cs.DrawLine (620,100,713,100);
cs.DrawLine (620,927,713,927);
cs.DrawLine (620,375,713,375);
cs.DrawLine (620,650,713,650);
cs.SetColor(255,0,0,0);
cs.DrawCircle(620,100,1);
cs.DrawCircle(620,375,1);
cs.DrawCircle(620,650,1);
cs.DrawCircle(620,927,1);
//cs.SetFillMode(1);
cs.SetTextStyle (0);
cs.SetStrokeWidth(0);
cs.SetColor (255,255,255,0);
cs.SetTextSize (70);
s="Welcome ... ...";
cs.DrawText (s,30,950);
cs.SetFillMode(1);
cs.SetTextSize (26);
s="编译人:张纯叔 (micelu@126.com) ";
cs.DrawText(s,30,1000);
cs.DrawText("Version 1.5.2",460,1000);
cs.Update ();
cs.SetFillMode(1);
cs.SetStrokeWidth(1);
}//drawcover ()
drawpad (){ //draw background Oval
float pi=3.1415926535;
float sx1,sy1;
float r,L,a;
int px,py;//图中心点
px=360;
py=430;
cs.SetFillMode(0);
cs.SetStrokeWidth(2);
cs.SetColor(255,250,100,120);
cs.DrawPoint(360,400);
for(i=0;i<68;i++){
cs.SetFillMode(1);
a=pi/30*i;
cs.SetColor(5,10,200,250);
sx1=(float)(px+sin(a));
sy1=(float)(py+cos(a));
cs.DrawOval(sx1,sy1,3+i*3,16+i*6,i*3); }
if (isdraw==1){
px=522; py=220;
cs.SetFillMode (0);//0不填色,1填色
for(i=0;i<30;i++){
cs.SetFillMode (0);
cs.SetStrokeWidth(1);
a=2*pi/30*i; L=200;
for(k=0;k<15;k++){
cs.SetColor(255,130+k*8,50+k*8,250);
sx=(float)(px+(L-k*2-120)*sin(a));
sy=(float)(py+(L-k*2-120)*cos(a));
cs.DrawOval(sx,sy,12,35,-i*12);
cs.DrawLine (px,py,sx,sy);
} } //紫色团花
cs.Update (); }
}//draw background
getWeekday (){//计算月首日星期几
int ds[3];
int n;
string sDat[101];
getDate(ds); //getDate = today
pickDate("输入日期:",ds);
sDat[n]=intToString(ds[0])+"-"+intToString(ds[1])+"-"+intToString(ds[2]);
clearOutput ();
//print ds[0],ds[1],ds[2];
dy=ds[0];
dm=ds[1];
dd=ds[2];
print "InputDate = ",dy ,"-",dm,"-",dd;
bds=intToString(dd); //this day $
int ty;
int tm;
ty=dy;
tm=dm;
if (dm<3){
ty=dy-1;
tm=dm+12;}
//first day=1 this month
//iWeek=(d+2*m+3*(m+1)/5+y+y/4-y/100+y/400)
//mod 7 基姆拉尔森公式
alln=2*tm+3*(tm+1)/5+ty+(int)(ty/4);
alln=alln-(int)(ty/100)+(int)(ty/400)+2;
wd=alln-alln/7*7; //mod (alln,7)
wds=subString(wdss,wd*3,3);
string yds; //for gz day wh 28star 12jian
string ydds;
double tms;
yds="000031059090120151181212243273304334"; ydds=subString(yds,(dm-1)*3,3);
tms=stringToDouble(ydds);
alln1=(dy-1900)*365+((dy-1900-1)/4)+(int)(tms)+1;
if ((dy-dy/4*4)==0&&dm>2)alln1=alln1+1;
print "all days = ",alln," ",alln1;
return ; // return weekday = wds $
}//getWeekday ()
showBZ(){
//calculate and show this day calendar
//show 生辰八字
getWeekday();
calendar ();
clearOutput();
cs.ClearDraw(0,src);
cs.Update();
isdraw=1;
drawpad ();
print "input date = ",dy, "-",dm,"-",dd;
string gds; //for festival
//gds=subString(getds,n*2,2); // show festival
cs.SetFillMode(1);
cs.SetColor (255,0,0,255);
n0=wd+dd-1;
n1=n0-n0/7*7;
if(n1==0)cs.SetColor (255,255,0,0);
if(n1==6)cs.SetColor (255,255,0,0);
cs.SetTextSize (30); //print nl GZ ggzs
//print 干支年 生肖
if(dm==ysm&&dd<ysd){n=dy-4-1;}else{n=dy-4;}
if(dm<ysm)n=dy-4-1;
gzn=(n-n/60*60);
//print "gzn = ",gzn;
ggzs=subString(gzs,gzn*2,2);
// print "gz $ = ",ggzs;
//农历月名 getms $
n1=(int)(nleap);
string nlrs;
if(ysm==2){
n=dm;
if(dd<msd1) n=n-1;
if (msd[dm]<=1)n=n+1;
if (dd>30&&msd1<2)n=n+1;
s2=subString (das2,n+2,1);
getms=subString(nlms,n*2,2);}
if(ysm==1){
if (dm<n1+1){
n=dm+1;
if (dd<msd1)n=dm;
}
if (dm==n1+1){
n=dm;
nlrs="闰";
if (dd<msd1){
n=dm;
nlrs=""; }
}
if (dm==n1+2){
n=dm;
nlrs="";
if (dd<msd1){
n=dm-1;
nlrs="闰";}
}
if (dm>n1+2){
nlrs="";
if (dd<msd1){ n=dm-1;}else{n=dm;}
}
if(msd[dm]<1)n=n+1;
s2=subString (das2,n+1,1);
s=subString(nlms,n*2,2);
getms=nlrs+s;
}
print "getms = ",getms;
s1=getms;
if(s1=="冬月")s1="十一月";
if(s1=="腊月")s1="十二月";
if (ysm==1)s2=subString(das2,n+0,1);
if (ysm==2)s2=subString (das2,n+0,1);
if(s2=="0") s2="小";
if(s2=="1") s2="大";
sxn=gzn-gzn/12*12;//生肖
gsxs=subString(sxs,sxn,1);
s="农历"+ggzs+"年"+"("+gsxs+")"+s1+s2;
cs.DrawText (s,20,540);
n=dd-1;
s=subString (getds,n*2,2)+"日";
cs.DrawText (s,340,540);
cs.DrawLine (20,500,690,500);
cs.DrawLine (20,580,690,580);
cs.DrawText (jqss1,20,620); //show solar
cs.DrawText (jqss2,20,660);
cs.SetFillMode(1);
n0=wd+dd-1;
n1=n0-n0/7*7;
dd2=intToString(dd); //print yy-mm
if(dd<10)dd2="0"+dd2;
s=intToString (dy)+" 年 ";
s=s+intToString(dm)+" 月 ";
s1=intToString(dd);
cs.SetTextSize (50);
cs.SetColor (255,10,180,20);
cs.DrawText (s,52,83);
if(dd<10)sx=140;
if (dd>9)sx=60;
cs.SetTextSize (250); //print dd
cs.DrawText (s1,sx+3,345); // print dd
cs.SetColor (255,0,0,255);
if(n1==0)cs.SetColor (255,255,0,0);
if(n1==6)cs.SetColor (255,255,0,0);
if(dm==1||dm==5||dm==6||dm==7||dm==8|| dm==10){
if (dd==1&&dy>1948)cs.SetColor (255,255,0,0); }
if(dm==ysm&&dd==ysd-1)cs.SetColor (255,255,0,0);
if(dm==ysm&&dd==ysd)cs.SetColor (255,255,0,0);
n=dd-1;
gds=subString (getds,n*2,2);
if(getms=="正月"&&gds=="十五")
cs.SetColor(255,255,0,0);
if(getms=="五月"&&gds=="初五")
cs.SetColor(255,255,0,0);
if(getms=="八月"&&gds=="十五")
cs.SetColor(255,255,0,0);
if(getms=="九月"&&gds=="初九")
cs.SetColor(255,255,0,0);
cs.SetTextSize (50); //print dd
cs.DrawText (s,50,80); //print yy-mm
cs.SetTextSize (250); //print dd
cs.DrawText (s1,sx,340);
cs.SetTextSize (40); //print weekday
n0=wd+dd-1;
n1=n0-n0/7*7;
s=subString (wdss,n1*3,3);
cs.SetColor (255,10,180,20);
cs.DrawText (s,152,462);
cs.SetColor (255,0,0,255);
if(n1==0)cs.SetColor (255,255,0,0);
if(n1==6)cs.SetColor (255,255,0,0);
cs.DrawText (s,150,460); //weekday
n=dd-1;
gds=subString(getds,n*2,2); // festival
//show festival ********
ss=" ";
cs.SetTextSize (36);
cs.SetColor (255,255,0,255);
i=dd;
s=gds;
print "农历月: ",getms," ",s;
string ss1;
if(dm==1&&i==1)ss="元旦节";
if(dm==ysm&&i==ysd-1)ss=" 除夕";
if(dm==ysm&&i==ysd)ss=" 春节";
if (dy>1948){
if(dm==2&&i==14)ss="情人节";
if(dm==3&&i==8)ss="妇女节";
if(dm==3&&i==12)ss="植树节";
if(dm==5&&i==1)ss="劳动节";
if(dm==5&&i==4)ss="青年节";
if(dm==5&&i==mn)ss="母亲节";
if(dm==6&&i==fn)ss="父亲节";
if(dm==6&&i==1)ss="儿童节";
if(dm==7&&i==1)ss="建党节";
if(dm==8&&i==1)ss="建军节";
if(dm==9&&i==10)ss="教师节";
if(dm==10&&i==1)ss="国庆节"; }
if(dm==12&&i==25)ss="圣诞节";
// if(getms=="正月"&&s=="初一")ss1="春节";
if(getms=="正月"&&s=="十五")ss1="元宵节";
if(getms=="二月"&&s=="初二")ss1="龙抬头";
if(getms=="五月"&&s=="初五")ss1="端午节";
if(getms=="七月"&&s=="初七")ss1="七夕节";
if(getms=="七月"&&s=="十五")ss1="中元节";
if(getms=="八月"&&s=="十五")ss1="中秋节";
if(getms=="九月"&&s=="初九")ss1="重阳节";
if(getms=="腊月"&&s=="初八")ss1="腊八节";
if(getms=="腊月"&&s=="廿三")ss1=" 小年";
if (s2=="小"&&getms=="腊月"&&s=="廿九")ss1=" 除夕";
ss=ss+ss1;
s5=" ";
if(dm==ysm&&i==ysd)s5="弥勒佛诞";
if (getms=="正月"&&s=="初六")s5="定光佛诞";
if(getms=="二月"&&s=="初八")s5="释迦牟尼佛出家";
if(getms=="二月"&&s=="十五")s5="释迦牟尼佛涅槃";
if(getms=="二月"&&s=="初九")s5="海空上师诞";
if(getms=="二月"&&s=="十九")s5="观世音菩萨诞";
if(getms=="二月"&&s=="廿一")s5="普贤菩萨诞";
if(getms=="三月"&&s=="十六")s5="准提菩萨诞";
if(getms=="四月"&&s=="初四")s5="文殊菩萨诞";
if(getms=="四月"&&s=="初八")s5="释迦牟尼佛诞";
if(getms=="四月"&&s=="十五")s5="佛吉祥日卫塞节";
//"0415 佛吉祥日—
//释迦牟尼佛诞生、成道、涅槃三期同一庆(即南传佛教国家的卫塞节)",
if(getms=="五月"&&s=="十三")s5="伽蓝菩萨诞"; if(getms=="六月"&&s=="初三")s5="护法韦驮尊天菩萨诞";
if(getms=="六月"&&s=="十九")s5="观世音菩萨成道";
// 此日放生、念佛,功德殊胜
if(getms=="七月"&&s=="十三")s5="大势至菩萨诞";
if(getms=="七月"&&s=="廿四")s5="龙树菩萨诞";
if(getms=="七月"&&s=="三十")s5="地藏菩萨诞";
if(getms=="八月"&&s=="廿二")s5="燃灯佛诞";
if(getms=="九月"&&s=="十九")s5="观世音菩萨出家";
if(getms=="九月"&&s=="三十")s5="药师琉璃光如来诞";
if(getms=="十月"&&s=="初五")s5="达摩祖师诞";
if(getms=="冬月"&&s=="初七")s5="阿弥陀佛诞";
if(getms=="腊月"&&s=="初八")s5="释迦如来成道日";
if(getms=="腊月"&&s=="廿九")s5="华严菩萨诞";
string jqss;
if (i==jqd1)jqss="今日"+jqs1;
if (i==jqd2)jqss="今日"+jqs2;
n=0;
cs.DrawText (ss,473-n,458); //show festival
cs.SetTextSize (30);
k=len (s5)*24/2;
cs.DrawText (s5,510-k,380); //show festival
cs.DrawText (jqss,463,410);
cs.SetTextSize (30); // show GZ
cs.SetColor(255,255,0,255);
s="今日"+bzs;
cs.DrawText (s,20,760);
s1=subString (whss,(gzy/2)*3,3);
s2=subString (whss,(gzm/2)*3,3);
s3=subString (whss,(gzd/2)*3,3);
s4=subString (whss,(gzh/2)*3,3);
s="年 : "+gzys+" "+s1; //show 五行
cs.DrawText (s,20,810);
s="月 : "+gzms+" "+s2;
cs.DrawText (s,20,840);
s="日 : "+gzds+" "+s3;
cs.DrawText (s,20,870);
s="时 : "+gzhs+" "+s4;
cs.DrawText (s,20,900);
n=alln1+3; //print 28stars
n1=n-n/28*28;
ss=subString (st28ss,n1,1);
cs.DrawText (ss,245,870);
n=alln1-(dy-1900)*12-dm+10; //show 12建日
if (dd>=jqd1)n=n-1;
n1=n-n/12*12;
ss=subString(g12ss,n1,1);
cs.DrawText (ss,275,870);
print "当日 : "+dy2+"-"+dm2+"-"+dd2;
print "alln = ",alln;
print "alln1 = ",alln1;
print "年首月: ",(int)(ysm);
print "年首日: ",(int)(ysd);
print "das2 = ",das2;
print "weekday = ",wd;
print "星期$ ",wds;
print "干支 : ",ggzs;
print "农历日 : ",getds;
print "节气 >节 ",jqd1," ", jqss1;
print "节气 >气 ",jqd2," ", jqss2;
print bzs; //BZ $
print "干支年 月 日 时 : ", gzy," ",gzm," ",gzd," ",gzh;
print "月首日 : ", msd1;
print "上年冬至 = ",dzd0," 本年冬至 = ",dzd1;
x0=360;
y0=800;
cs.SetTextSize(24);
s=" 起时 : ";
cs.DrawText(s,x0,y0);
s="23 - 1 11 - 13";
cs.DrawText(s,x0,y0+30);
s=" 1 - 3 13 - 15";
cs.DrawText(s,x0,y0+60);
s=" 3 - 5 15 - 17";
cs.DrawText(s,x0,y0+90);
s=" 5 - 7 17 - 19";
cs.DrawText(s,x0,y0+120);
s=" 7 - 9 19 - 21";
cs.DrawText(s,x0,y0+150);
s=" 9 - 11 21 - 23";
cs.DrawText(s,x0,y0+180);
for(i=0;i<6;i++){
s1=subString(gzs,(gzh+i)*2,2);
s2=subString(gzs,(gzh+6+i)*2,2);
s=s1+" "+s2;
cs.DrawText(s,x0+80,y0+30+i*30);}
//芒种后丙日入梅 小暑后未日出梅
int jjiu,jiu1,jiu2; //print and show 九九
string jius;
jius="一二三四五六七八九";
cs.SetTextSize (30);
if (dm>11&&dd>=dzd1||dm<4){
if(dm==12&&dd>=dzd1)jjiu=dd-dzd1;
if(dm==1)jjiu=31-dzd0+dd;
if(dm==2)jjiu=31-dzd0+31+dd; if(dm==3&&dd<13)jjiu=31-dzd0+31+28+dd;
jiu2=jjiu-(int)(jjiu/9*9)+1;
jiu1=(int)(jjiu/9)+1;
print "jiu1 = ",jiu1," jiu2 = ",jiu2;
s0=subString (jius,jiu1-1,1);
s1=intToString (jiu2);
ss=s0+"九第 "+s1+" 天 ";
if(jjiu>80)ss=" ";
print jjiu;
print ss;
if (dm==3&&dd>12)ss=" ";
cs.DrawText (ss,495,540);
} //show jiujiu$
ss=" ";
if (dm==6&&dd>4&&dd<17){
s0=subString (gzds,0,1);
if (s0=="丙"){ ss="今日入梅";}else{ss=" ";}
cs.DrawText (ss,500,540);}
if (dm==7&&dd>6&&dd<18){
s0=subString (gzds,1,1);
if (s0=="未"){ ss="今日出梅";}else{ss=" ";}
cs.DrawText (ss,500,540);}
//show fu day ******
// 夏至后第三个庚日起10天为初伏
//夏至后第四个庚日到立秋后第一个庚日为中伏
//立秋后第一个庚日起10天为末伏
int fn;
string fu1,fu2,fu3;
fu1="初伏第";
fu2="中伏第";
fu3="末伏第";
n=(dd-dd/10*10)-((gzd-gzd/10*10)-6);
if (n<10)n=n+10;
print n," 日干支 庚日 ",gzd;
if (dm==7&&dd>n-1){
n0=dd-n+1;
print n0;
if (dd>n-1&&dd<=n+9){
s=fu1+intToString (n0);}
if (dd>n+9){
s=fu2+intToString (n0-10);}
ss=s+"天";
cs.DrawText (ss,495,540); }
if (dm==8){
//print n," 日干支 庚日 ",gzd;
if (dd<n+10){
n0=31-n-10+dd;
if (dd<n)
{ss=fu2+intToString (n0)+"天";}
if (dd>=n){ss=fu3+intToString (n0-20)+"天";}
cs.DrawText (ss,495,540);}
} //show three fu day
setDisplay (1);
cs.Update ();
cs.Active ();
}//showBZ()
calnlds(){
//calculate 农历月$ getms 农历日$ getds*******
//double zm; // 正月n
//double lmd,tmd; //上月大小,本月大小
//double nleap,nleapd; //农历闰月,0无闰,闰月大小
s=daList[dy-1];
das0=s;
print "last year = ",dy-1;
print "last year das0 = ", das0;
s=daList[dy];
das1=s;
print "this year = ",dy;
print "this year das1 = ",das1;
s=subString(das1,15,1);
ysm=stringToDouble(s);
print "年首月 = ",(int)(ysm);
s=subString(das1,16,2);
ysd=stringToDouble(s);
print "月首日 = ",(int)(ysd);
s=subString(das1,13,1);
nleap=stringToDouble (s);
n=(int)(nleap);
s=subString(das1,12,1);
nleapd=stringToDouble (s);
print " nleap = ", nleap," ",nleapd;
if(nleap==0){
ss=subString (das0,10,2)+subString (das1,0,12);
}else {ss=subString(das0,11,1)+subString(das1,0,n)+subString(das1,12,1)+subString(das1,n,12-n);}
das2=ss;
print "new das2 = ",das2;
print " ";
//calculate msd(12) // 年 月朔日$
n0=(int)(ysd); //年首日起算
if (dy-(int)(dy/4)*4==0){leap=1;}else{leap=0;}
//print "leap = ",leap;
if (ysm==1){
s=subString(das2,1,1);
if (s=="1"){n=30;}else{n=29;}
msd[1]=n0;
msd[2]=msd[1]+n-31; }
if (ysm==2){
s=subString(das2,1,1);
if (s=="1"){n=30;}else{n=29;}
msd[1]=31+n0-n;
msd[2]=n0; }
s=subString(das2,2,1);
if (s=="1"){n=30;}else{n=29;}
msd[3]=msd[2]+n-28-leap;
s=subString(das2,3,1);
if (s=="1"){n=30;}else{n=29;}
msd[4]=msd[3]+n-31;
s=subString(das2,4,1);
if (s=="1"){n=30;}else{n=29;}
msd[5]=msd[4]+n-30;
s=subString(das2,5,1);
if (s=="1"){n=30;}else{n=29;}
msd[6]=msd[5]+n-31;
s=subString(das2,6,1);
if (s=="1"){n=30;}else{n=29;}
msd[7]=msd[6]+n-30;
s=subString(das2,7,1);
if (s=="1"){n=30;}else{n=29;}
msd[8]=msd[7]+n-31;
s=subString(das2,8,1);
if (s=="1"){n=30;}else{n=29;}
msd[9]=msd[8]+n-31;
s=subString(das2,9,1);
if (s=="1"){n=30;}else{n=29;}
msd[10]=msd[9]+n-30;
s=subString(das2,10,1);
if (s=="1"){n=30;}else{n=29;}
msd[11]=msd[10]+n-31;
s=subString(das2,11,1);
if (s=="1"){n=30;}else{n=29;}
msd[12]=msd[11]+n-30;
print "全年朔日 : ";
for(i=1;i<13;i++){
print "dm= ",i," ",msd[i];}
getds=" ";
n0=msd[dm]; //msd 月朔日
s=subString(das2,dm-1,1);
if (n0<=1) s=subString (das2,dm,1);
if(s=="1"){n=30;}else{n=29;}
//lmd=n; //上月农历天数
if(n0<=1)n0=n+n0;
msd1=n0;
print "月朔日 : ”,n0;
string gs1,gs2;
gs1=subString(nlds,(n-n0+1)*2,(n0-1)*2);
gs2=subString(nlds,0,(31-n0+1)*2);
getds=gs1+gs2;
print getds; //农历日$
//农历月名$
n1=(int)(nleap); //2017 nleap n1=6;
if(ysm==2) getms=subString(nlms,dm*2,2);
if(ysm==1){
if(dm<n1+1)getms=subString(nlms,(dm+1)*2,2);
if(dm==n1+1){
s=subString(nlms,dm*2,2);
getms="闰"+s;}
if(dm>n1+1)getms=subString(nlms,dm*2,2);
}
print "月份 = ",dm," , 农历月 = ",getms;
}//calnlds ()
calendar(){
//calculate and show calendar ************
calnlds(); //取得农历日$ getms, getds
cs.ClearDraw (0,src);
string fname;
fname="/storage/emulated/0/view02.jpg";
cs.DrawBitmap(fname,0,2); //加底图
isdraw=0;
// drawpad ();
// print " show weekday = ",wd;
cs.SetTextStyle (1); //粗体
cs.SetStrokeWidth (1);
s=intToString (dm);
if (dm<10){sx=250;}else{sx=170;}
cs.SetFillMode (1);//0不填色,1填色
cs.SetTextSize (300); //print big dm
cs.SetColor (80,0,160,0);
cs.DrawText (s,sx,595);
cs.SetFillMode (0);//0不填色,1填色
cs.SetTextSize (300); //print big dm
cs.SetColor (200,250,220,160);
cs.DrawText (s,sx,595);
cs.SetFillMode (1);//0不填色,1填色
cs.SetTextSize (19);
cs.SetColor (255,255,0,0);
s="星期日";
cs.DrawText (s,103,230);
s="星期六";
cs.DrawText (s,522,230);
cs.SetColor(255,0,0,240);
s="星期一 星期二 星期三 星期四 星期五”;
cs.DrawText (s,176,230);
cs.DrawLine(50,200,630,200);
cs.DrawLine(50,250,630,250);
cs.DrawLine(50,750,630,750);
cs.SetTextSize (66); //print yymm
s=intToString (dy)+" · ";
leap=0;
n=0;
if (dm<10)n=20;
s1=intToString (dm);
cs.SetColor(220,0,90,0);
cs.DrawText (s+s1,320+n+4,180+3);
cs.SetColor(255,0,0,240);
cs.DrawText (s+s1,320+n,180);
cs.SetFillMode (0);//0不填色,1填色
cs.SetColor(255,250,160,0);
cs.DrawText (s+s1,320+n,180); //print yymm
cs.SetColor(255,0,0,240);
cs.SetFillMode (1);//0不填色,1填色
//**** calculate solarterm //show 节气
dy2=intToString(dy); //show 节气
dm2=intToString(dm);
dy1=stringToDouble(dy2);
dm1=stringToDouble(dm2);
cs.SetTextSize (30);
dy0=dy1;
n=dm*2-1;
caljq();
jqd1=(int)(dd1);
jqs1=subString(jname2,0,2);
cs.DrawText (jname2,50,790);
jqss1=jname2;
n=dm*2;
caljq ();
jqd2=(int)(dd1);
jqs2=subString(jname2,0,2);
cs.DrawText(jname2,50,830);
jqss2=jname2;
if (dm==12)dzd1=jqd2; //show 九九
print "本年冬至:”,dzd1;
if (dm<4){
n=24;
dy0=dy1-1;
caljq ();
dzd0=(int)(dd1);
print "上年冬至:”,dzd0;}
if(dm==1)s="January";
if(dm==2)s="February";
if(dm==3)s="March";
if(dm==4)s="April";
if(dm==5)s="May";
if(dm==6)s="June";
if(dm==7)s="July";
if(dm==8)s="August";
if(dm==9)s="September";
if(dm==10)s="October";
if(dm==11)s="Novamber";
if(dm==12)s="December";
sx=(1100-len(s)*20)/2;
cs.SetTextSize (28);
cs.DrawText (s,sx,80);
//print 干支年 生肖
if(ysm==2&&dm==1){n=dy-4-1;}else{n=dy-4;}
gzn=(n-n/60*60);
//print "gzn = ",gzn;
ggzs=subString(gzs,gzn*2,2);
// print "gz $ = ",ggzs;
if (ysm==1)s1=subString(nlms,dm*2,2);
if (ysm==2)s1=subString(nlms,dm*2,2);
s1=getms; //print "正月"
if(s1=="冬月")s1="十一月";
if(s1=="腊月")s1="十二月";
int chuxi;
if (ysm==1)s2=subString(das2,dm+0,1);
if (ysm==2)s2=subString (das2,dm+0,1);
if(s2=="1"){s2="大"; chuxi=0; }
else{s2="小"; chuxi=1; }
s=ggzs+"年"+s1+s2;//年干支
sxn=gzn-gzn/12*12;//生肖
gsxs=subString(sxs,sxn,1);
ggzs=s+"("+gsxs+")";
cs.DrawText(ggzs,60,180);
cs.SetColor (255,0,0,240);
if(dm==1)ns=32;
if(dm==2)ns=29;
if (dy/4*4==dy)leap=1;
if (dm==2&&leap==1)ns=30;
if(dm==3)ns=32;
if(dm==4)ns=31;
if(dm==5)ns=32;
if(dm==6)ns=31;
if(dm==7)ns=32;
if(dm==8)ns=32;
if(dm==9)ns=31;
if(dm==10)ns=32;
if(dm==11)ns=31;
if(dm==12)ns=32;
//calnlds(); //取得农历月日$ getms, getds
fmn=0;
for (i=1;i<ns;i++){//print a.d. print get ms ds $
cs.SetColor (255,0,0,240);
cs.SetTextSize (30);
n=0; setc=0;
sx=(i+wd-1)-((i+wd-1)/7*7); //mod (sx,7)
sy=(i+wd-1)/7;
if (sx==0||sx==6)cs.SetColor(255,255,0,0);
if (i==1&&dy>1948){
if (dm==1||dm==5||dm==6||dm==7||dm==8||dm==10){cs.SetColor(255,255,0,0);}
}
if(dm==ysm&&i==ysd-1)cs.SetColor (255,255,0,0);
if(dm==ysm&&i==ysd)cs.SetColor (255,255,0,0);
if(getms=="八月"&&s=="十五")setc=12;
if (sx==0)fmn=fmn+1;
if (dm==5&&fmn==2&&sx==0)mn=i;
if (dm==6&&fmn==3&&sx==0)fn=i;
//for father mather festival
x1=sx*70+114;
y1=sy*80+300;
s=intToString(i);
n=0;
if (len(s)==1)n=10;
cs.DrawText (s,x1+n,y1); //print date$
cs.SetTextSize (20);
// **** s="初一"; //打印农历日期 *******
n=0;
s=subString (getds,(i-1)*2,2); //print dd$
s2=s;
if(s=="初一"){
s=getms; //print "正月"
if (msd[dm]<2&&i>22)s=subString (nlms,(dm+1)*2,2);
if(s=="冬月")s="十一月";
if(s=="腊月")s="十二月";
if(s=="腊月")s1="十二月"; }
//**** show festival ***************
//**** putout solarterm on table
if(i==jqd1)s=jqs1;
if(i==jqd2)s=jqs2;
// print mn,fn;
if(dm==1&&i==1)s="元旦节";
if(dm==ysm&&i==ysd-1)s="除夕";
if(dm==ysm&&i==ysd)s="春节";
if (dy>1948){
if(dm==2&&i==14)s="情人节";
if(dm==3&&i==8)s="妇女节";
if(dm==3&&i==12)s="植树节";
if(dm==5&&i==1)s="劳动节";
if(dm==5&&i==4)s="青年节";
if(dm==5&&i==mn)s="母亲节";
if(dm==6&&i==fn)s="父亲节";
if(dm==6&&i==1)s="儿童节";
if(dm==7&&i==1)s="建党节";
if(dm==8&&i==1)s="建军节";
if(dm==9&&i==10)s="教师节";
if(dm==10&&i==1)s="国庆节"; }
if(dm==12&&i==25)s="圣诞节";
if(dm==2&&getms=="正月"&&s2=="十五"){s="元宵节";setc=12;}
if(dm==2&&getms=="二月"&&s2=="十五"){s="元宵节";setc=12;}
if(dm==3&&i<10&&getms=="二月"&&s2=="十五"){s="元宵节";setc=12;}
if(dm==2&&getms=="二月"&&s2=="初二")s="龙抬头";
if(dm==3&&getms=="二月"&&s2=="初二")s="龙抬头";
if(dm==5&&getms=="五月"&&s2=="初五"){s="端午节"; setc=12;}
if(dm==6&&getms=="五月"&&s2=="初五"){s="端午节"; setc=12;}
if(dm==7&&getms=="七月"&&s2=="初七")s="七夕节";
if(dm==8&&getms=="七月"&&s2=="初七")s="七夕节";
if(ysm==1&&getms=="八月"&&s2=="十五")s="中元节";
if(ysm==2&&getms=="七月"&&s2=="十五")s="中元节";
if(ysm==1&&getms=="九月"&&s2=="十五"&&i<20){s="中秋节";setc=12;}
if(ysm==2&&getms=="八月"&&s2=="十五"){s="中秋节";setc=12;}
//if(ysm==1&&getms=="十月"&&s2=="初九"){s="重阳节"; setc=12;}
if(getms=="九月"&&s2=="初九"){s="重阳节";setc=12;}
if(ysm==1&&getms=="正月"&&s2=="初八"&&i<20)s="腊八节";
if(ysm==2&&getms=="腊月"&&s2=="初八")s="腊八节";
if(ysd<8&&s1=="十二月"&&s2=="廿三")s="小年";
if(ysd>=8&&s1=="正月"&&s2=="廿三")s="小年";
if (i>1&&chuxi==1&&s1=="十二月"&&s2=="廿九")s="除夕";
// cs.SetColor (255,255,0,0);
if (setc==12)cs.SetColor (255,255,0,0);
if (len(s)==3)n=10;
cs.DrawText(s,x1-2-n,y1+30);
cs.SetColor (100,250,250,20);
if(dd==i){ //draw today mark
cs.DrawRect (x1-10,y1-30,x1+45,y1+10);}
} //print a.d. dd$ festival
//calculate GZ,gzy,gzm,gzd,alln
print "节气日 : ",jqd1;
alln1=alln1+dd-1; //all days
n=(dy+2096);
if(dm<2)n=n-1;
if(dm==2&&dd<jqd1)n=n-1;
gzy=n-(int)(n/60*60);
s1=subString(gzs,gzy*2,2);
if(dd<jqd1){mz=1;}else{mz=0;}
gzn1=(dy+2096)*12+dm-mz;
gzm=gzn1-(int)(gzn1/60*60);
s2=subString (gzs,gzm*2,2);
n1=alln1+9;
gzd=n1-(int)(n1/60*60);
s3=subString(gzs,gzd*2,2);
gzh=(gzd-(int)(gzd/5*5))*12;
s4=subString(gzs,gzh*2,2);
cs.SetColor(255,255,0,240);
cs.SetTextSize(30);
if(len(bds)==1)bds="0"+bds;
s="日期 : "+dy2+" 年 "+dm2+" 月 "+bds+ " 日";
cs.DrawText(s,50,870);
gzys=s1;
gzms=s2;
gzds=s3;
gzhs=s4;
s="八字 : "+s1+" "+s2+" "+s3+" "+s4;
bzs=s; //bazi y,m,d,h
cs.DrawText(s,50,910);
print bzs;
x0=400;
y0=800;
cs.SetTextSize(24);
s="起时 : ";
cs.DrawText(s,400,y0);
s="23 - 1 11 - 13";
cs.DrawText(s,400,y0+30);
s=" 1 - 3 13 - 15";
cs.DrawText(s,400,y0+60);
s=" 3 - 5 15 - 17";
cs.DrawText(s,400,y0+90);
s=" 5 - 7 17 - 19";
cs.DrawText(s,400,y0+120);
s=" 7 - 9 19 - 21";
cs.DrawText(s,400,y0+150);
s=" 9 - 11 21 - 23";
cs.DrawText(s,400,y0+180);
for(i=0;i<6;i++){
s1=subString(gzs,(gzh+i)*2,2);
s2=subString(gzs,(gzh+6+i)*2,2);
s=s1+" "+s2;
cs.DrawText(s,480,y0+30+i*30);}
setDisplay (1);
cs.Update ();
}//calendar () ***********************
myToolBarProc(int nBtn,int nContext)
{
if(nBtn==100){//计算星期, 显示月历
getWeekday();
print "weekday = ",wd;
print "get weekday = ",dy ,"-",dm,"-",1;
print "weekday$ ? = ",wds;
calendar();
}
if(nBtn==101){//显示月历
// print " wd = ",wd;
if (isdraw==0){
getWeekday ();
calendar (); }else{ calendar (); }
setDisplay (1);
}
if(nBtn==102){//显示 生辰八字
showBZ ();
}
if(nBtn==103){//显示 八字起时
setDisplay (0);
//clearOutput();
print " ";
print "八字起时 > : ";
print " ";
for (i=0;i<30;i++){
gzh=i*2;
s1=subString (gzs,(gzh*2),2);
s2=subString (gzs,(gzh*2+2),2);
s4=subString (whss,i*3,3);
s=s1+" "+s2+" : "+s4;
print s;}
}
if(nBtn==104){//退出程序
clearOutput();
cs.ClearDraw (0,src);
//cs.Update();
setDisplay (0);
exit (0);
}
if(nBtn==105){//版本信息
setDisplay (1);
drawcover (); }
}//Toolbar () ***********************
caljq(){//calculate solar ** return jname2
juD=dy0*(365.2423112-0.000000000000064
*(dy0-100)*(dy0-100)- 0.00000003047
*(dy0-100))+15.218427*n+1721050.71301;
//juD=juD-0.00215;
tht=0.0003*dy0-0.372781384-0.2617913325*n;
yrD=(1.945*sin(tht)-0.01206*sin(2*tht))
*(1.048994-0.00002583 *dy0);
sD=-0.0018*sin(2.313908653*dy0
-0.439822951-3.0443*n);
//'vs = juD '** 平气
vs = (juD + yrD + sD); // '** 定气
dalt=-15+(juD-2382148)*(juD-2382148)/41048480;
//print dalt;
dalt = dalt/86400;
//print dalt;
jd = vs - 0.5 - dalt-0.025; // + 0.008;
int gg;
gg=n-(int)(n/2*2);
jdtoGD ();
//jqs1=subString (jqnames,(n-1)*2,2);
//print "jqs1 = ",jqs1;
s=jqs1+" " +jname2;
//print jname2;
}//caljq() ***********************************
//calculate jd to GD ** return jname2 *****
jdtoGD(){
double a,b,c,d,e;
double F;
double allss;
F=jd-(int)(jd);
//print " ";
//print " JD = ",jd;
//print " 时分秒 日小数 = ",F;
a=(int)(jd+0.5);
b=a+1537;
c=(int)((b-122.1)/365.25);
d=(int)(365.25*c);
e=(int)((b-d)/30.6001);
dd1=b-d-(int)(30.6001*e);
dm1=e-1-(int)((e/14)*12);
dy1=c-4715-(int)((7+dm1)/10);
//print a," ",b," ",c," ",d," ",e;
dy2=intToString (dy);
dm2=intToString (dm);
dd2=doubleToString (dd1);
if (len(dm2)==1)dm2="0"+dm2;
if (dd1<10)dd2="0"+dd2;
dd2=subString (dd2,0,2);
//print dy2+" 年 "+dm2+" 月 "+dd2+" 日 ";
if(n==24)jqdn=(int)(dd1);
if (n==24&&dm1<3)jqdn=jqdn+1;
//日allss 的小数转为时分秒
allss=(int)((jd-a)*86400+43200.5);
//print "allss = ", allss;
hh1=(int)(allss/3600);
mm1=(int)((allss-hh1*3600)/60);
ss1=(int)(allss-hh1*3600-mm1*60);
if(ss1>=60){
ss1=ss1-60;
mm1=mm1+1;}
if(mm1>=60){
mm1=mm1-60;
hh1=hh1+1;}
//print "JD 转为 GD,计算结果:”;
hh2=doubleToString(hh1);
mm2=doubleToString(mm1);
ss2=doubleToString(ss1);
if(hh1<10){
hh2="0"+doubleToString(hh1);}
if(mm1<10){
mm2="0"+doubleToString(mm1);}
if(ss1<10){
ss2="0"+doubleToString(ss1);}
hh2=subString (hh2,0,2);
mm2=subString (mm2,0,2);
ss2=subString (ss2,0,2);
jname1=subString(jqnames,(n-1)*2,2);
//print "节气 : ",jname1;
jname2=jname1+" > "+dm2+"-"+dd2+" "+hh2+":"+mm2+":"+ss2;
//return jname2;
}//jdtoGD() **************
readDat(){
daList[1899] = "101010110101000210";
daList[1900] = "010010111101080131";
daList[1901] = "010010101110000219";
daList[1902] = "101001010111000208";
daList[1903] = "010100100110050129";
daList[1904]= "110100100110000216";
daList[1905] = "110110010101000204";
daList[1906]= "011010101010140125";
daList[1907] = "010101101010000213";
daList[1908] = "100110101101000202";
daList[1909]= "010010101110020122";
daList[1910]= "010010101110000210";
daList[1911] = "101001001101060130";
daList[1912]= "101001001101000218";
daList[1913]= "110100100101000206";
daList[1914] = "110101010100150126";
daList[1915]= "101101010101000214";
daList[1916]= "010101101010000204";
daList[1917]= "100101101101020123";
daList[1918]= "100101011011000211";
daList[1919]= "010010011011170201";
daList[1920]= "010010011011000220";
daList[1921]= "101001001011000208";
daList[1922]= "101100100101050128";
daList[1923]= "011010100101000216";
daList[1924] = "011011010100000205";
daList[1925] = "101011011010140124";
daList[1926] = "001010110110000213";
daList[1927] = "100101010111000202";
daList[1928]= "010010010111020123";
daList[1929]= "010010010111000210";
daList[1930] = "011001001011060130";
daList[1931] = "110101001010000217";
daList[1932] = "111010100101000206";
daList[1933] = "011011010100150126";
daList[1934] = "010110101101000214";
daList[1935] = "001010110110000204";
daList[1936]= "100100110111130124";
daList[1937] = "100100101110000211";
daList[1938]= "110010010110170131";
daList[1939] = "110010010101000219";
daList[1940] = "110101001010000208";
daList[1941]= "110110001010160127";
daList[1942] = "101101010101000215";
daList[1943]= "010101101010000205";
daList[1944] = "101010101101140125";
daList[1945]= "001001011101000213";
daList[1946] = "100100101101000202";
daList[1947]= "110010010101020122";
daList[1948]= "101010010101000210";
daList[1949]= "101101010101070129";
daList[1950] = "011011001010000217";
daList[1951] = "101101010101000206";
daList[1952] = "010101011010150127";
daList[1953]= "010011011010000214";
daList[1954]= "101001011011000203";
daList[1955]= "010100101011130124";
daList[1956] = "010100101011000212";
daList[1957] = "101010010101080131";
daList[1958] = "111010010101000218";
daList[1959]= "011010101010000208";
daList[1960]= "101011010101060128";
daList[1961] = "101010110101000215";
daList[1962] = "010010110110000205";
daList[1963] = "101001010111040125";
daList[1964]= "101001010111000213";
daList[1965]= "010100100110000202";
daList[1966]= "111010010011030121";
daList[1967] = "110110010101000209";
daList[1968]= "010110101010070130";
daList[1969] = "010101101010000217";
daList[1970]= "100101101101000206";
daList[1971]= "010010101110050127";
daList[1972]= "010010101101000215";
daList[1973]= "101001001101000203";
daList[1974]= "110100100110040123";
daList[1975]= "110100100101000211";
daList[1976]= "110101010010080131";
daList[1977]= "101101010100000218";
daList[1978]= "101101101010000207";
daList[1979]= "100101101101160128";
daList[1980]="100101011011000216";
daList[1981]="010010011011000205";
daList[1982]="101011001011040125";
daList[1983]="101001001011000213";
daList[1984]="1011001001110a0202";
daList[1985]="011010100101000220";
daList[1986]="011011010100000209";
daList[1987]="101011011010060129";
daList[1988]="101010110110000217";
daList[1989]="100100110111000206";
daList[1990]="010010010111050127";
daList[1991]="010010010111000215";
daList[1992]="011001001011000204";
daList[1993]="011010100101030123";
daList[1994]="111010100101000210";
daList[1995]="011010110010080131";
daList[1996]="010110101100000219";
daList[1997]="101010110110000207";
daList[1998]="100101101101050128";
daList[1999]="100100101110000216";
daList[2000]="110010010110000205";
daList[2001]="110101001010040124";
daList[2002]="110101001010000212";
daList[2003]="110110100101000201";
daList[2004]="010110101010020122";
daList[2005]="010101101010000209";
daList[2006]="101010111011070129";
daList[2007]="001001011101000218";
daList[2008]="100100101101000207";
daList[2009]="110010101011050126";
daList[2010]="101010010101000214";
daList[2011]="101101001010000203";
daList[2012]="101110101010040123";
daList[2013]="101011010101000210";
daList[2014]="010101011101090131";
daList[2015]="010010111010000219";
daList[2016]= "101001011011000208";
daList[2017]= "010100010111160128";
daList[2018]= "010100101011000216";
daList[2019]= "101010010011000205";
daList[2020]= "011110010101040125";
daList[2021]= "011010101010000212";
daList[2022]= "101011010101000201";
daList[2023]= "010110110101020122";
daList[2024]= "010010110110000210";
daList[2025]= "101001101110060129";
daList[2026]= "101001001110000217";
daList[2027]= "110100100110000206";
daList[2028]= "111010100110050126";
daList[2029]= "110101010011000213";
daList[2030]= "010110101010000203";
daList[2031] = "011101101010030123";
daList[2032]= "100101101101000211";
daList[2033] = "010010111101070131";
daList[2034]= "010010101101000219";
daList[2035] = "101001001101000208";
daList[2036]= "110100001011060128";
daList[2037]= "110100100101000215";
daList[2038] = "110101010010000204";
daList[2039] = "110111010100050124";
daList[2040]= "101101011010000212";
daList[2041]= "010101101101000201";
daList[2042]= "010101011011020122";
daList[2043]= "010010011011000210";
daList[2044]= "101001010111070130";
daList[2045]= "101001001011000217";
daList[2046]= "101010100101000206";
daList[2047] = "101100100101150126";
daList[2048] = "011011010010000214";
daList[2049] = "101011011011000202";
daList[2050]= "011101101010050124";
daList[2051]= "100100110111000211";
daList[2052]= "010010011111080201";
daList[2053] = "010010010111000219";
daList[2054]= "011001001011000208";
daList[2055] = "011010001010160128";
daList[2056] = "111010100101000215";
daList[2057]= "011010110010000204";
daList[2058] = "101001111100140124";
daList[2059] = "101010101110000212";
daList[2060]= "100100101110000202";
daList[2061]= "110100101110030121";
daList[2062] = "110010010110000209";
daList[2063] = "110101010101070129";
daList[2064]= "110101001010000217";
daList[2065] = "110110100101000205";
daList[2066]= "010111010101050126";
daList[2067] = "010101101010000214";
daList[2068]= "101001101101000203";
daList[2069]= "010101011101040123";
daList[2070]= "010101101101000211";
daList[2071] = "101010011011080131";
daList[2072] = "101010010101000219";
daList[2073]= "101101001010000207";
daList[2074] = "101101101010060127";
daList[2075] = "101011010101000215";
daList[2076] = "010101011010000205";
daList[2077] = "101010111010040124";
daList[2078]= "101001011011000212";
daList[2079]= "010100101011000202";
daList[2080] = "101100100111030122";
daList[2081]= "011010010011000209";
daList[2082] = "011100110011070129";
daList[2083] = "011010101010000217";
daList[2084]= "101011010101000206";
daList[2085] = "010010110101150126";
daList[2086]= "010010110110000214";
daList[2087]= "101001010111000203";
daList[2088]= "010101001110040124";
daList[2089] = "110100010110000210";
daList[2090]= "111010010110080130";
daList[2091]= "110101010010000218";
daList[2092] = "110110101010000207";
daList[2093]= "011010101010060127";
daList[2094] = "010101101101000215";
daList[2095]= "010010101110000205";
daList[2096]= "101010011101040125";
daList[2097] = "101001001101000212";
daList[2098] = "110100010101000201";
daList[2099] = "111100100101020121";
daList[2100] = "110101010010000209";
return;
}
//**** End ****