乙個日曆C程式

2021-06-04 18:14:05 字數 784 閱讀 4785

由於c語言當初沒學好,像c的結構體,檔案流,指標等都還弄不明白。

下面是最近的乙個**,關於列印日曆的。

/*calendar

列印出某年的日曆,由使用者指出1月1日是星期幾以及該年是否為閏年。

表示1月1日是星期幾的編碼:

0 sunday 1 monday 2 tuesday 3 wednesday 4 thuray 5 friday 6 saturday

表示是否為閏年的編碼:

0 不是 1 是

@author jeff chen

@version 1.0 date:2012-03-08

*/#includeint main()

while(day_code<0||day_code>6);

int days_in_month;

int month;

int day;

for(month=1;month<=12;month++)

//輸出星期

printf("\n\nsun mon tue wed thu fri sat\n");

for(day=1;day0)

printf(" ");

else

printf("\n");

}//設定下乙個星期的星期**

day_code=(day_code+days_in_month)%7;

}return 0;

}

乙個日曆程式

year currentdate 年 month currentdate 月 hiddenid getusername 3 日一 二三四五 六 ym year currentdate month currentdate i 1do while i 33 j 1response.write do wh...

乙個日曆小程式

include define sunday 0 define monday 1 define tuesday 2 define wednesday 3 define thursday 4 define friday 5 define saturday 6 void giveinstructions ...

C語言 編寫乙個日曆

題目 列印乙個月份的日曆。分析 首先列印乙個月份的日曆,要設定乙個基準年,並且要知道這一年的一月一號是週幾 求得當年的一月一號是週幾 在求得當月的第一天是週幾。define crt secure no warnings 1 include include 某個月的日曆 int months 2 13...