万年历C++课程设计
《万年历C++课程设计》由会员分享,可在线阅读,更多相关《万年历C++课程设计(11页珍藏版)》请在毕设资料网上搜索。
1、 第 1 页 共 11 页 万年历万年历 一、一、目的与要求目的与要求 显示公元后任何年份的日历,日历以月份的顺序排列,每月以星期顺序排列,类似于一般挂历 上的格式。 二、二、工具工具/准备工作准备工作 在开始实验前,应回顾并复习相关内容。 我使用的软件是 Dev-C+。 三、三、分析分析 1、大月和小月的定义,主要运用了数组的循环语句进行对大小月的定义。 void f1(int x) /大月 for( i=0;i=0;i-) ai=000; for(i=k;iyear; coutyear; coutendl; c=year; for(s=1;s=year;s+) if(s-1)%4=0 da
2、y=365*c+count; /相差天数 cout“-“year“年日历-“; coutendlendl; k=(day%7+6)%7+1; 第 5 页 共 11 页 cout“ 一月“endlendl; f1(k); g(a,50); cout“-“endl; cout“-“endl; if(year%4=0 cout“ 二月“endlendl; f3(k); g(a,50); cout“-“endl; cout“-“endl; day=day+31+29; else /非闰年二月 k=(day+31)%7+6)%7+1; cout“ 二月“endlendl; f4(k); g(a,50);
3、 cout“-“endl; cout“-“endl; day=day+31+28; k=(day%7+6)%7+1; cout“ 三月“endlendl; f1(k); g(a,50); cout“-“endl; cout“-“endl; k=(day+31)%7+6)%7+1; cout“ 四月“endlendl; f2(k); g(a,50); cout“-“endl; cout“-“endl; k=(day+31+30)%7+6)%7+1; cout“ 五月“endlendl; f1(k); g(a,50); cout“-“endl; 第 6 页 共 11 页 cout“-“endl; k=(day+31+30+31)%7+6)%7+1; cout“ 六月“endlendl; f2(k); g(a,50); cout“-“endl; cout“-“endl; k=(day+31+30+31+30)%7+6)%7+1; cout“ 七月“endlendl; f1(k); g(a,50)
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中设计图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 万年历 C+ 课程设计
