C课程设计报告-改进万年历 (1).docx
《C课程设计报告-改进万年历 (1).docx》由会员分享,可在线阅读,更多相关《C课程设计报告-改进万年历 (1).docx(19页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、发周期:C语言课程设计报告设计题目:万年历系统班 级:学 号:学生姓名:指导老师:完成日期:if(iError) printf(nPress any key to continue.Ann);getch();iYear=stSystemDate.iYear;iMonth=stSystemDate.iMonth;iDay=stSystemDate.iDay;stCurrentDate=stSystemDate;)iNumCurrentMon=aiMoniMonth;/* 当前月 份的天数*/iNumLastMon=aiMoniMonth-1 ;/*上月 的天数*/iWeekday=iDayInL
2、astMon=GetWeekday(i Year,iMonth, 1 );/* 该月一号为星期几system(“CLS);/* 清屏*/GotoXY(LAYOUT,0);printf(n The Calender of %dM,iYear);GotoXY(LAYOUT+11,1);printf(H%sH,acMoniMonth);GotoXY(LAYOUT,2);PrintUnderline();GotoXY(LAYOUX3);printf(Sun Mon The Wed Thu Fru Sat);GotoXY(LAYOUX4);PrintSpace(iDayInLastMon * 4);wh
3、ile(iOutputDay=aiMoniMonth)if(iOutputDay=iDay) if(iDay5?0:iWeekday+l;/* 星期数递增*/ iOutputDay+;GotoXY(LAYOUTJO);PrintUnderline();GotoXY(LAYOUT+2,11);printf(nThe day you choose is:);GotoXY(LAYOUT+2J 3);PrintWeek(&stCurrentDate);GotoXY(LAYOUTJ4);PrintUnderline();GotoXY(LAYOUT+2,l 5);printf(nToday is:nn);
4、GotoXY(LAYOUT+2,l 7);PrintWeek(&stSystemDate);GotoXY(LAYOUTJ8);PrintUnderline();Printlnstruction();GotoXY(0,20);)void PrintWeek(struct Date*pstTempDate) if(pstTempDate=NULL) printf(nThis is a null pointer!n);return;)intiDay=GetWeekday(pstTempDate-iYear,pstTempDate-iMonth,pstTempDate-iDay)printf(H%4d
5、-%02d-%02d/pstTempDate-iYear,pstTempDate-iMonth,pstTemp Date-iDay);switch(iDay)case O:printf(nSunday!);break;case l:printf(nMonday!n);break;case 2:printf(nTuesday! n);break;case 3:printf(nWednesday!H);break;case 4:printf(nThursday!n);break;case 5 :printf(nFriday !H);break;case 6:printf(nSaturday!);b
6、reak;)void Printlnstruction() GotoXY(0,0);printf(=Instniction=);GotoXY(0,2);printf(HInquiren);GotoXY(14,2);printf(HI/i key”);GotoXY(0,3);printf(HResetH);GotoXY(14,3);printf(R/r key);GotoXY(0,4);printf(nQuitH);GotoXY(14,4);printf(nQ/q key);GotoXY(0,5);printf(Whole year);GotoXY(14,5);printf(nW/w keyn)
7、;GotoXY(0,6);printf();GotoXY(0,8);printf(nYearn);GotoXY(9,8);printf(HThe key to + :PageUp);GotoXY(9,9);printf(nThe key to - :PageDownn);GotoXY(OJl);printf(HMonthn);GotoXY(9,ll);printf(HThe key to + : t );GotoXY(9,12);printf(nThe key to -: 1 n);GotoXY(0,14);printf(HDayH);GotoXY(9,14);printf(HThe key
8、to + L);GotoXY(9,15);printf(nThe key to + : -)void PrintWholeYear(int iYear,int iMonth,int iDay)intiOutputDay= 1 ,iOutputMonth= 1 ,iError=0,iDayInLastMon=0,iWeekday=0,iRow=0,iTe mp=3,iCol=40;char c;if(IsLeapYear(iYear) aiMon2=29;elseaiMon2=28;)if(iDay aiMon iMonth) printf(nThis month(%s) has at most
9、 ddaysn,acMoniMonth,aiMoniMonth);iError= 1;)if(iError) printf(nPress any key to continue.Ann);getch();iYear=stSystemDate.iYear;iMonth=stSystemDate.iMonth;iDay=stSystemDate.iDay;stCurrentDate=stSystemDate;i Weekday=iDayInLastMon=GetWeekday(i Year, 1,1);GotoXY(18,0);printf(HThe Calendar of the whole %
10、d,iYear);if(IsLeapYear(iYear) printf(HLeap Year!nn);elseprintf(nCommon Year!nn);)GotoXY(OJ);printf(nSun Mon Tue Wed Thu Fri Satn);GotoXY(iColJ);printf(nSun Mon Tue Wed Thu Fri Satn);while(iOutputMonth= 12)iRow=iTemp;GotoXY(iColJRow-l);PrintUnderline();if(iOutputMonth%2) iCol=0;elseiCol=40;iTemp+=8;/
11、*奇左偶右*/iOutputDay=l;GotoXY(iCol+10,iRow);printf(n%sH,acMoniOutputMonth);GotoXY(iCoL+iRow);PrintSpace(iDayInLastMon*4);if(iOutputMonth=iMonth) while(iOutputDay=aiMoniOutputMonth) if(iOutputDay=iDay) if(iDay5?0:iWeekday+l; iOutputDay+;)elsewhile(iOutputDay5?0:iWeekday+1; iOutputDay+;iOutputMonth+;iDay
12、InLastMon=i Weekday;)iRow=iTemp;GotoXY(0,iRow-l);PrintUnderline();GotoXY(40,iRow-l);PrintUnderline();GotoXY(0,iRow);printf(nPress any key to return to the main interface!nn); getch();)显示界面日期显示界面SunThe Calendar of 2020JanuaryThe Calendar of 2020JanuaryMonTueUed Thu8Fri310Sat411SunMonTueUed 1 8Thu2 91
13、2131415161718 I 12131416192021222324251 19202122232627282930311 2627282930Fri310172431Sat4111825全年日历界面及模块流程图SunMonTheTue Wed ThuCalendar of Fri Satthe whole 2015Common Vear?SatSunMonTueUed Thu FriJanuaryFebruary12312345674567891089101112131411121314151617151617181920211819202122232422232425262728252
14、62728293031MarchApril12345671234891011121314567891011151617181920211213141516171822232425262728192021222324252930312627282930MayJune1212345634567897891011121310111213141614151617181920171819202122232122232425262724252627282930282930图365功能选择模块6.5.1 功能设计模块主要用于响应键盘操作,依据获取的按键值选择相应的功能来响应,从而实 现了功能选择。该函数主要
15、由GetKeyO实现。6.5.2 子模块函数(1) void GetKeyO源代码:int GetKeyO int iFirst= 1;char cKey=0,c=0;while(l)PrintCalendar(stCurrentDate.iYear,stCurrentDate.iMonth,stCurrentDate.iDay); if(iFirst)GotoXY(0J9);printf(nPlease read the instruction carefully!nn);iFirst=0;)cKey=getch();if(cKey-32)cKey=getch();switch(cKey)c
16、ase UP: if(stCurrentDate.iMonth 1) stCurrentDate.iMonth; else stCurrentDate.iYear; stCurrentDate.iMonth= 12; break;)case LEFT: if(stCurrentDate.iDay 1) stCurrentDate.iDay; elseif(stCurrentDate.iMonth= 1) stCurrentDate.iYear; StCurrentDate.iMonth= 12; stCurrentDate.iDay=31;elseStCurrentDate.iMonth-;s
17、tCurrentDate.iDay=31;)break;case RIGHT: if(stCurrentDate.iDayiNumCurrentMon) stCurrentDate.iDay+;elseif(stCurrentDate.iMonth= 12)stCurrentDate.iYear+;stCurrentDate.iMonth=l; stCurrentDate.iDay=l;elsestCurrentDate.iMonth+; stCurrentDate.iDay=l; ) break;)casePAGE_UP:stCurrentDate.iYear+;break;)casePAG
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C课程设计报告-改进万年历 1 课程设计 报告 改进 万年历
限制150内