C語言寫日曆

2021-08-17 09:09:56 字數 935 閱讀 2749

#include

/*1970-1-1 星期四*/

// 以1970-1-1作為基準

int start_year = 1970;

int start_month = 1;

int start_day = 1;

//將以char輸進來的字串轉換成int型,並完成錯誤檢查和資訊篩選

int char_to_int(char *s, int size)

else

}return result;

}//將給定的年月日通過基準時間算出對應的星期

int count_week(int year, int month, int day)

}switch(month)

if(month > 2)

}days += day;

week = (4+days-1)%7;

return week;

}//列印日曆,將所屬為day的日期特殊列印

C語言日曆

根據的乙個問題整理的 輸入年月,顯示當前日曆,然後按下左右方向鍵會顯示上個月或下個月的日曆,按其他鍵兩次退出 include include include includebool isleapyear int year else int calwkd int year,int month if i...

c語言輸出日曆

include void main else sum sum 365 按照capucivar的思路,接下來要計算從該年1月到使用者輸入月份的上乙個月的天數 for int j 1 j int a sum 7 計算出總天數跟7求餘,得到乙個餘數 int monthday z是使用者輸入月份的天數 sw...

我用C 寫的日曆

只要呼叫構造方法就可以啦 using system using system.collections.generic using system.linq using system.text public class calendar 構造方法 年 public calendar int year e...