1樓:小夏在深圳
c語言編寫萬年曆的源**如下:
#include
int week(int y,int m,int d);
int main()
char wk[7][3] = ,,,,,,};
int year, month, day, w;
w = week(year, month, day);
printf("%d年%d月%d日 星期%s", year, month, day, wk[w]);
int week(int y,int m,int d)static int r[13]=;
int c,w;
y %= 400;
<3)c = 5;
else
c = 6;
w = (y+y/4-y/100+r[m]+d+c)%7;
return w;
}擴充套件資料電子時鐘c語言版的源**如下:
#include
#include
#include
int main()
char str[50];
time_t t;
struct tm *nt;
while(1)
system("cls");//清屏函式
t=time(null);
nt=localtime(&t);
strftime(str,50,"%y-%m-%d %h:%m:%s 「,nt);
printf("現在時刻:%s\n",str);
getch();
return 0;
2樓:無情天魔精緻
/*c語言編寫萬年曆問題
該程式簡單地輸入乙個年份(2023年之後的年份),隨後程式輸出該年份十二個月的日曆。*/
#define mon 1
#define tues 2
#define wed 3
#define thur 4
#define fri 5
#define sat 6
#define sun 0
#define january_days 31
#define february_days 28
#define march_days 31
#define april_days 30
#define may_days 31
#define june_days 30
#define july_days 31
#define august_days 31
#define september_days 30
#define october_days 31
#define november_days 30
#define december_days 31
#define first1month january_days
#define first2month january_days+february_days
#define first3month january_days+february_days+march_days
#define first4month january_days+february_days+march_days+april_days
#define first5month january_days+february_days+march_days+april_days+may_days
#define first6month january_days+february_days+march_days+april_days+may_days+june_days
#define first7month january_days+february_days+march_days+april_days+may_days+june_days \
+july_days
#define first8month january_days+february_days+march_days+april_days+may_days+june_days \
+july_days+august_days
#define first9month january_days+february_days+march_days+april_days+may_days+june_days \
+july_days+august_days+september_days
#define first10month january_days+february_days+march_days+april_days+may_days+june_days \
+july_days+august_days+september_days+october_days
#define first11month january_days+february_days+march_days+april_days+may_days+june_days \
int known_weekday = tues;
int known_year = 1901;
int konwn_month = 1;
int known_day = 1;
int day_count(int month) }
/*char * month_name(int month)
}*/char * month_name(int month) }
/*按格式列印某年某月名稱*/
void first_line_print(int month, int year)
/*按格式列印星期名稱*/
void week_print()
/*計算該年該月份與已知日子之間的距離天數*/
int date_distance_count(int month, int year) }
} else
if (year == known_year) }
distance = (year - known_year)*365 + leap_year_count + day_count(month);
return distance;
} /*確定該月份第一天是星期幾*/
int makesure_firstday_weekday(int month, int year)
/*依次列印出該月份的日子*/
void print_in_turn(int month, int firstday, int year)
switch(month)
} break;
} case 2:
} break;
} else /*平年*/
} break;
} }case 4:
case 6:
case 9:
case 11:
} break;
}} }void date_print(int month, int year)
void main_month(int month, int year)
void main_calendar(int year) }
int main()
main_calendar(year);
scanf(" ");
return 0;}
c語言編寫一萬年曆系統
c語言版本的已經發往你的郵箱,請查收 現已更新好,去除農曆資訊 沒有用c寫過,上面是c builder寫的 上面的c 寫的 include include int daysandweek int y,int week bool runnian int void main char month 12 ...
用C語言編寫2023年曆(急求,用C語言編寫2023年曆(急求!!!)
mfc 和 delphi嗎?你知道這樣沒有意義又很麻煩嗎 沒價值 自己動手修改乙個函式就好了 include include define days 366 struct calendar void createcal struct calendar year 建立2008年日曆 int findw...
康巴萬年曆怎麼調時間,萬年曆的時間設定怎麼更改?
萬年曆後面有四個鍵分別為上調 下調 設定 退回,先按設定鍵進入時間設定狀態,同時年份閃爍,可按上調或下調鍵修改年份,修改好後按設定鍵將閃爍位移到公曆月,按上調或下調鍵修改月份。萬年曆是中國古代傳說中最古老的一部太陽曆。萬年曆是記錄一定時間範圍內的具體陽曆與陰曆的日期的年曆,方便有需要的人查詢使用。家...