万年历C源代码

上传人:闪**** 文档编号:298847852 上传时间:2022-05-26 格式:DOCX 页数:7 大小:16.55KB
返回 下载 相关 举报
万年历C源代码_第1页
第1页 / 共7页
万年历C源代码_第2页
第2页 / 共7页
万年历C源代码_第3页
第3页 / 共7页
万年历C源代码_第4页
第4页 / 共7页
万年历C源代码_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《万年历C源代码》由会员分享,可在线阅读,更多相关《万年历C源代码(7页珍藏版)》请在金锄头文库上搜索。

1、本文格式为Word版,下载可任意编辑万年历C源代码 #include iostream using namespace std; /#include stdafx.h/1900.1.1是星期1 int yeardaysform1900(int year); int mouthdays(int year,int mouth); void printyear(); void printmouth(int ,int); void findday(); char *dayss=日,一,二,三,四,五,六; int main() cout*endl; cout* 接待本万年历! *endl; cout*

2、endl; do cout李金香,请选择:endl; cout-1.显示莫一年的万年历 -endl; cout-2.显示莫一月的万年历 -endl; cout-3.查询莫一天的 -endl; cout-0.退出 -endl; int choice; cinchoice; hh:switch(choice) case 1:printyear();break; case 2: int year,mouth;cout请输入年和月,如:2022 10endl; cinyearmouth; printmouth(year,mouth);break; case 3:findday();break; cas

3、e 0:exit(0);break; default:cout输入错误,请重新输入:endl; cinchoice;goto hh; while(1); return 0; int yeardaysform1900(int year) int i,days=0; for(i=1990;iyear;i+) if(i%4=0i%100!=0|i%400=0) days+=366; else days+=365; return days; int mouthdays(int year,int mouth) int days; bool aa; if(year%4=0year%100!=0|year%

4、400=0)aa=true; else aa=false; switch(mouth) case 1:case 3:case 5:case 7:case 8:case 10:case 12: days=31;break; case 2:if(aa)days=29;else days=28;break; default:days=30; return days; void printyear() coutendl; cout请输入年:endl; coutendlendl; int year;int i; cinyear; for(i=1;i13;i+) printmouth(year,i);fo

5、r(int i=0;i100000000;i+); void printmouth(int year,int mouth) int i,days=0; coutendl; /int year,mouth; /cout请输入年和月,(如2022 3)endl; coutendl; /cinyearmouth; days+=yeardaysform1900(year); for(i=1;imouth;i+) days+=mouthdays(year,i); i=days%7; int j=0;int aa=0; coutyear年mouth月endl; for(j=0;j7;j+) coutday

6、ssj ;coutendl; for(j=0;ji+1;j+) cout ;aa+; if(aa%7=0)coutendl; for(j=1;j=mouthdays(year,mouth);j+) if(aa%7=0)coutendl; coutj ;aa+; coutendl; void findday()cout请输入年月日,如:2022 10 1endl; int year,mouth,day; cinyearmouthday;int totalday=0,i; for(i=1900;iyear;i+) totalday+=yeardaysform1900(i); for(i=1;imouth;i+) totalday+=mouthdays(year,i); for(i=1;iday;i+); totalday+=i; totalday%=7; coutyear年mouth月day日是星期daysstotaldayendl; 7

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 大杂烩/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号