计算生日的C#或java的演示。

使用系统;使用系统。集合。泛型;使用系统。组件模型;使用系统。数据;使用系统。绘图;使用系统。Linq使用系统。文本;使用系统。Windows . Forms命名空间BrithdayEigth { public partial class Form 1:Form { public Form 1(){ initialize component();}公静弦[] date = { "甲子"、"乙丑"、"丙寅"、"丁卯"、"陈武"、"基斯"、"耿武"、"韦辛"、"任申"、"贵由"、"甲午"、"乙亥"。《辛巳》《壬午》《癸未》《沈嘉》《乙酉》《徐炳》《丁亥》《伍兹》《己丑》《庚寅》《辛卯》《陈稔》《癸巳》、。《陈佳》、《一四》、《吴冰》、《丁伟》、《武神》、《益友》、《耿旭》、《辛亥》、《壬子》、《鬼筹》、《甲寅》、《怡宝》、《陈冰》、《等》。public int yearZi = 0;private void btnOk_Click(对象发送方,EventArgs e) { DateTime dt=Day。价值;int year=dt。年份;int moon = dt。月份;int date = dt。DayOfYearMessageBox。show(" Test:"+(year % 60-3)+":"+moon+":"+date);//调用获取出生日期字符串yearZi = yearZ(year)的方法;string moonZi = moonZ(月,年);string dayZi = dayei(年份,日期);int hour = int。解析(小时日期。正文);string hourZi= Hours(小时、日期、年);txtBrithday。text = yearZi+" "+moonZi+" "+dayZi+" "+hourZi;} private void form 1 _ load(object sender,event arse){ }//获取出生日期公共字符串yearz(int y){ int yearzie = year num(y)的方法;返回日期[yearZie-1];}公共字符串moonZ(int m,int year){ int year zie = year num(year);if(yearZie & gt;= 12){ if(yearZie % 10 = = 6 | | yearZie % 10 = = 1){返回日期[2+m-1];} else if(yearZie % 10 = = 2 | | yearZie % 10 = = 7){ return date[14+m-1];} else if(yearZie % 10 = = 3 | | yearZie % 10 = = 8){返回日期[26+m-1];} else if(yearZi % 10 = = 4 | | yearZi % 10 = = 9){返回日期[38+m-1];} else if(yearZie % 10 = = 5 | | yearZie % 10 = = 0){ return date[50+m-1 & gt;60 ?(m-11):49+m】;} } else { if(year zie = = 6 | | year zie = = 1){ return date[2+m-1];} else if(year zie = = 2 | | year zie = = 7){返回日期[14+m-1];} else if(year zie = = 3 | | year zie = = 8){返回日期[26+m-1];} else if (yearZi == 4 || yearZi == 9) {返回日期[38+m-1];} else if(yearZie = = 5 | | yearZie = = 10){ return date[50+m-1 & gt;60?(m-11):49+m】;} }返回日期[1];}公共字符串dayei(int year,int day){ int year zie = year num(year);返回日期[(yearZie+day)% 60-1];}公共字符串Hours(int hour,int day,int year){ int year zie = year num(year);string strH =int datey =(yearZie+day)% 60-1;int dateZi = datey % 10;if(datezi = = 1 | | datezi = = 5){ strh+= " A ";} else if(datezi = = 2 | | datezi = = 6){ strh+= " c ";} else if(datezi = = 3 | | datezi = = 7){ strh+= " e ";} else if(datezi = = 4 | | datezi = = 8){ strh+= "庚";} else if(datezi = = 5 | | datezi = = 0){ strh+= "壬";}如果(小时& gt0 & amp& amp小时& lt= 1){ strH+= " son ";} else if(hour & gt;1。& amp小时& lt= 3) {strH += "丑";} else if(hour & gt;3 & amp& amp小时& lt= 5) {strH += "阴";} else if(hour & gt;5 & amp& amp小时& lt= 7) {strH += "毛";} else if(hour & gt;7 & amp& amp小时& lt= 9) {strH += "陈";} else if(hour & gt;9 & amp& amp小时& lt= 11){ strH+= " Si ";} else if(hour & gt;11。& amp小时& lt= 13) {strH += "正午";} else if(hour & gt;13。& amp小时& lt= 15){ strH+= " Not ";} else if(hour & gt;15 & amp;& amp小时& lt= 17) {strH += "沈";} else if(hour & gt;17。& amp小时& lt= 19) {strH += "儿子";} else if(hour & gt;19 & amp;& amp小时& lt= 21) {strH += "酉";} else if(hour & gt;21。& amp小时& lt= 23){ strH+= " E ";} else if(hour & gt;0 & amp& amp小时& lt= 1){ strH+= " Hai ";}返回strH} public int year num(int year){ int year zie = year % 60-3;if(yearZie & lt;= 0){ yearZie+= 60;}返回yearZie} }}