1.mfc 编写万年历 怎么编 我是农历农历白痴 求指导
2.用C语言怎么编写万年历
3.用Python计算年份属于哪个天干地支 源代码
4.ç¨VBå¦ä½åä¸å¹´å?
mfc 编写万年历 怎么编 我是白痴 求指导
我这里有现成的代码,可供你参考,源码源码主要是数据自绘的实现,附件给你两个版本的农历农历,均是源码源码MFC的(如下图)。第一个是数据在线教育系统源码java摘自网上的程序,但经我改良,农历农历农历数据使用自创的源码源码算法,年份支持也大大增加(从公元年至年),数据并且修正了部分错误。农历农历
第二个是源码源码自创的,是数据MFC绘制出来的界面,支持两种视图。农历农历
代码都是源码源码在VS上编译通过的,如需要源代码,数据请追问。
//判断闰年,参数:年份,闰年,返回值:FALSE-失败,TRUE-成功static BOOL IsLeapYear(WORD dwYear,商业博客源码BOOL &bLeapYear);
//计算日期在年内的序数,参数:年,月,日,年内序数,返回值:FALSE-失败,TRUE-成功
static BOOL GetDaysNumInYear(WORD dwYear, WORD dwMonth, WORD dwDay,WORD &nDays);
//从年内序数计算月、日,参数:年,年内序数,月,dedecms女性站源码日,返回值:FALSE-失败,TRUE-成功
static BOOL GetDateFromDays(WORD dwYear, WORD nDays, WORD &dwMonth, WORD &dwDay);
//获取农历新年的公历年内序数,参数:农历年,返回值:农历新年的公历年内序数
static short LunarGetNewYearOrdinal(WORD dwLunarYear);
//获取农历月的天数,参数:农历年,农历月,是否为闰月,返回值:该农历月的天数,为0代表参数无效
static WORD LunarGetDaysofMonth(WORD dwLunarYear,东莞比深圳源码WORD dwLunarMonth,BOOL bLeapMonth);
//获取农历某一年的闰月情况,参数:农历年,返回值,该年的闰月月份,0表示无闰月
static WORD LunarGetLeapMonth(WORD dwLunarYear);
//公历转农历,参数:公历年、月、日,农历年、月、日,表白网站源码HTML是否为闰月,返回值:FALSE-失败,TRUE-成功
static BOOL GetLunar(WORD dwYear,WORD dwMonth,WORD dwDay,WORD &dwLunarYear,WORD &dwLunarMonth,WORD &dwLunarDay,BOOL &bLeapMonth);
//农历转公历,参数:家历年、月、日,是否为闰月,公历年、月、日,返回值:FALSE-失败,TRUE-成功
static BOOL GetGregorian(WORD dwLunarYear,WORD dwLunarMonth,WORD dwLunarDay,BOOL bLeapMonth,WORD &dwYear,WORD &dwMonth,WORD &dwDay);
//得到指定年份的节气信息,首个是小寒
static BOOL GetJieQi(WORD dwYear,WORD dwMonth,WORD dwJieQi[2]);
//计算星期,返回-1表示输入的年月日不正确或者超出年份范围
static short GetDayOfWeek(WORD dwYear,WORD dwMonth,WORD dwDay);
//计算某个月的天数,返回天数,如果返回0表示年或月有误
static WORD GetDaysOfMonth(WORD dwYear,WORD dwMonth);
//把iYear年格式化成天干记年法表示的字符串
static void FormatLunarYear(WORD iYear, char *pBuffer);
//把iMonth格式化成中文字符串
static void FormatLunarMonth(WORD iMonth, char *pBuffer, BOOL bLeapMonth=FALSE);
//把iDay格式化成中文字符串
static void FormatLunarDay(WORD iDay, char *pBuffer);
用C语言怎么编写万年历
1、首先下载安装Notepad++,这是一款免费的且能够编辑C语言的软件。2、然后下载安装tdm-gcc,这是为了给电脑配置环境变量,以便能够编译C语言的。
3、在安装完以上两款软件后,还要配置一下环境变量。
4、然后开始编辑C语言万年历,首先要判断一个年份是闰年还是平年,用一个子程序来做:
5、然后就开始写主程序:首先用scanf得到一个年份,在判断这个年份是平年还是闰年后用printf在CMD中打出来。
6、在编写完成后,在Notepad++界面下按下F5,在输入框中输入:
cmd /k gcc -o "$(CURRENT_DIRECTORY)\$(NAME_PART).exe" "$(FULL_CURRENT_PATH)" && CLS && "$(CURRENT_DIRECTORY)\$(NAME_PART).exe" & PAUSE & EXIT
7、最后点击运行,会弹出CMD,在里面输入年份后回车:例如输入,然后回车,就会生成年的万年历了!
用Python计算年份属于哪个天干地支 源代码
这个是我原创的,如果有考虑不周的地方可以交流一下:y=int(input("请输入公历年份(公元前请加“-”):"))t=(y-4)%%
d=(y-4)%%
T=["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
D=["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
print("{ }年为:农历{ }{ }年".format(y,T[t],D[d]))
运行结果:
ç¨VBå¦ä½åä¸å¹´å?
ç»ä½ 个ååçVBæºç .
curTime = MaskEdBox1
'ææå
WeekName(0) = " * "
WeekName(1) = "æææ¥"
WeekName(2) = "ææä¸"
WeekName(3) = "ææäº"
WeekName(4) = "ææä¸"
WeekName(5) = "ææå"
WeekName(6) = "ææäº"
WeekName(7) = "ææå "
'天干å称
TianGan(0) = "ç²"
TianGan(1) = "ä¹"
TianGan(2) = "ä¸"
TianGan(3) = "ä¸"
TianGan(4) = "æ"
TianGan(5) = "å·±"
TianGan(6) = "åº"
TianGan(7) = "è¾"
TianGan(8) = "壬"
TianGan(9) = "ç¸"
'å°æ¯å称
DiZhi(0) = "å"
DiZhi(1) = "ä¸"
DiZhi(2) = "å¯ "
DiZhi(3) = "å¯"
DiZhi(4) = "è¾°"
DiZhi(5) = "å·³"
DiZhi(6) = "å"
DiZhi(7) = "æª"
DiZhi(8) = "ç³"
DiZhi(9) = "é "
DiZhi() = "æ"
DiZhi() = "亥"
'å±ç¸å称
ShuXiang(0) = "é¼ "
ShuXiang(1) = "ç"
ShuXiang(2) = "è"
ShuXiang(3) = "å "
ShuXiang(4) = "é¾"
ShuXiang(5) = "è"
ShuXiang(6) = "马"
ShuXiang(7) = "ç¾"
ShuXiang(8) = "ç´"
ShuXiang(9) = "鸡"
ShuXiang() = "ç"
ShuXiang() = "çª"
'ååæ¥æå
DayName(0) = "*"
DayName(1) = "åä¸"
DayName(2) = "åäº"
DayName(3) = "åä¸"
DayName(4) = "åå"
DayName(5) = "åäº"
DayName(6) = "åå "
DayName(7) = "åä¸"
DayName(8) = "åå «"
DayName(9) = "åä¹"
DayName() = "åå"
DayName() = "åä¸"
DayName() = "åäº"
DayName() = "åä¸"
DayName() = "åå"
DayName() = "åäº"
DayName() = "åå "
DayName() = "åä¸"
DayName() = "åå «"
DayName() = "åä¹"
DayName() = "äºå"
DayName() = "廿ä¸"
DayName() = "廿äº"
DayName() = "廿ä¸"
DayName() = "廿å"
DayName() = "廿äº"
DayName() = "廿å "
DayName() = "廿ä¸"
DayName() = "å»¿å «"
DayName() = "廿ä¹"
DayName() = "ä¸å"
'ååæ份å
MonName(0) = "*"
MonName(1) = "æ£"
MonName(2) = "äº"
MonName(3) = "ä¸"
MonName(4) = "å"
MonName(5) = "äº"
MonName(6) = "å "
MonName(7) = "ä¸"
MonName(8) = "å «"
MonName(9) = "ä¹"
MonName() = "å"
MonName() = "åä¸"
MonName() = "è "
'å ¬åæ¯æåé¢ç天æ°
MonthAdd(0) = 0
MonthAdd(1) =
MonthAdd(2) =
MonthAdd(3) =
MonthAdd(4) =
MonthAdd(5) =
MonthAdd(6) =
MonthAdd(7) =
MonthAdd(8) =
MonthAdd(9) =
MonthAdd() =
MonthAdd() =
'ååæ°æ®
NongliData(0) =
NongliData(1) =
NongliData(2) =
NongliData(3) =
NongliData(4) =
NongliData(5) =
NongliData(6) =
NongliData(7) =
NongliData(8) =
NongliData(9) =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
NongliData() =
'çæå½åå ¬åå¹´ãæãæ¥ ==> GongliStr
curYear = Year(curTime)
curMonth = Month(curTime)
curDay = Day(curTime)
GongliStr = curYear & "å¹´"
If curMonth < Then
GongliStr = GongliStr & "0" & curMonth & "æ"
Else
GongliStr = GongliStr & curMonth & "æ"
End If
If curDay < Then
GongliStr = GongliStr & "0" & curDay & "æ¥"
Else
GongliStr = GongliStr & curDay & "æ¥"
End If
'çæå½åå ¬åææ ==> WeekdayStr
curWeekday = Weekday(curTime)
WeekdayStr = WeekName(curWeekday)
'计ç®å°åå§æ¶é´å¹´2æ8æ¥ç天æ°ï¼-2-8(æ£æåä¸)
TheDate = (curYear - ) * + Int((curYear - ) / 4) + curDay + MonthAdd(curMonth - 1) -
If curYear Mod 4 = 0 And curMonth > 2 Then
TheDate = TheDate + 1
End If
'计ç®åå天干ãå°æ¯ãæãæ¥
isEnd = 0
m = 0
Do
If NongliData(m) < Then
k =
Else
k =
End If
n = k
Do
If n < 0 Then
Exit Do
End If
'è·åNongliData(m)ç第n个äºè¿å¶ä½çå¼
bit = NongliData(m)
For i = 1 To n Step 1
bit = Int(bit / 2)
Next
bit = bit Mod 2
If TheDate <= + bit Then
isEnd = 1
Exit Do
End If
TheDate = TheDate - - bit
n = n - 1
Loop
If isEnd = 1 Then
Exit Do
End If
m = m + 1
Loop
curYear = + m
curMonth = k - n + 1
curDay = TheDate
If k = Then
If curMonth = (Int(NongliData(m) / ) + 1) Then
curMonth = 1 - curMonth
ElseIf curMonth > Int(NongliData(m) / ) + 1 Then
curMonth = curMonth - 1
End If
End If
'çæåå天干ãå°æ¯ãå±ç¸ ==> NongliStr
NongliStr = "åå" & TianGan(((curYear - 4) Mod ) Mod ) & DiZhi(((curYear - 4) Mod ) Mod ) & "å¹´"
NongliStr = NongliStr & "(" & ShuXiang(((curYear - 4) Mod ) Mod ) & ")"
'çæååæãæ¥ ==> NongliDayStr
If curMonth < 1 Then
NongliDayStr = "é°" & MonName(-1 * curMonth)
Else
NongliDayStr = MonName(curMonth)
End If
NongliDayStr = NongliDayStr & "æ"
NongliDayStr = NongliDayStr & DayName(curDay)
Label2 = NongliStr & NongliDayStr