C語言版 農曆演算法

2022-03-25 07:57:10 字數 1389 閱讀 5707

這個只是基本的農曆演算法,另外的節日查詢啊,可以自己做的。到**找乙個萬年曆,改寫成c語言的就可以了。

char *getdayof(systemtime pst)

;const char *cdizhi = ;

const char *cshuxiang = ;

const char *cdayname = ;

const char *cmonname = ;

const int wmonthadd[12] = ;

const int wnonglidata[100] =

;static int wcuryear, wcurmonth, wcurday;

static int nthedate, nisend, m, k, n, i, nbit;

tchar sznongli[512], sznongliday[512];

wcuryear = pst.wyear;

wcurmonth = pst.wmonth;

wcurday = pst.wday;

nthedate = (wcuryear - 1921) * 365 + (wcuryear - 1921) / 4 + wcurday + wmonthadd[wcurmonth - 1] - 38;

if ((!(wcuryear % 4)) && (wcurmonth > 2)) nthedate = nthedate + 1;

nisend = 0; m = 0;

while (nisend != 1)

nthedate = nthedate - 29 - nbit;

n = n - 1;

}if (nisend) break;

m = m + 1;

}wcuryear = 1921 + m;

wcurmonth = k - n + 1;

wcurday = nthedate;

if (k == 12)

wsprintf(sznongli, "%s%s年 (%s年) ", ctiangan[((wcuryear - 4) % 60) % 10], cdizhi[((wcuryear - 4) % 60) % 12], cshuxiang[((wcuryear - 4) % 60) % 12]);

if (wcurmonth < 1)

wsprintf(sznongliday, "閏%s月", cmonname[ -1 * wcurmonth]);

else wsprintf(sznongliday, "%s月", cmonname[wcurmonth]);

strcat(sznongliday, cdayname[wcurday]);

return strcat(sznongli, sznongliday);} 

**

C語言版 農曆演算法

這個只是基本的農曆演算法,另外的節日查詢啊,可以自己做的。到 找乙個萬年曆,改寫成c語言的就可以了。char getdayof systemtime pst const char cdizhi const char cshuxiang const char cdayname const char c...

Sunday演算法c語言版實現

一 bf演算法 bf演算法是普通的模式匹配演算法,其基本思想就是將目標串的第乙個字元與模式串的第乙個字元進行匹配。若相等,則繼續比較第二個字元 若不相等,則比較目標串的第二個字元和模式串的第乙個字元。依次比較下去,直到得出最後的匹配結果。示例 static int bf const char src...

排序演算法彙總 C語言版

首先在未排序序列中找到最小 大 元素,存放到排序序列的起始位置,再從剩餘未排序元素中繼續尋找最小 大 元素,然後放到已排序序列的末尾,重複操作。演算法分析 第一輪比較是陣列中的第乙個元素與其他的元素一 一對比,只要找到比它小的,它兩就交換順序,所以第乙個相對於已經進行比較過的元素而言是最小的,繼續比...