欢迎来到天天文库
浏览记录
ID:48368637
大小:78.50 KB
页数:7页
时间:2019-11-28
《C编程实验指导书.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、《C++编程》实验指导书程保中谢锦一、实验一:C++程序编制1、实验目的学生通过使用C++语言进行基本程序的开发,掌握C++通用IDE,练习类的定义与使用、掌握运算符的重载。2、实验内容(详细内容见附件)3、实验环境a)Windows2000或WindowsXPb)VC6.04、实验要求1)独立完成实验内容要求。2)熟练使用VC6.0IDE进行编程。3)需要上交源程序文件。5、实验步骤1)启动VC6.0IDE。2)建立workspace利Iproject。3)编辑源程序。4)编译、链接并执行源程序,看结果是否止确。5)如杲报错或告警,做必
2、要修改,垂复3)——5)步骤直到没冇错误和告警。附件:实验要求LabProject1Thislabmighttakelongtimesodonotwaituntilthelastmoment.Startasearlyaspossible.Goal:•TofamiliarizeyourselfwithcodinginObjectOrientedProgramming.•GettingstartedwithClasses,Objectsandtheirusage・ProblemDescriptionInthislab,youaregoingt
3、odevelopacalendarsystemwhichprintsoutthedates(alongwithcorrespondingdays)forthegivenamonthandyear.Userinputsthefollowingdetailstohelpyoucalculatetherequiredmonth'sdays:1.Year-Yearforwhichthecalendarisrequired.2.Month一Monthforwhichyouhavetooutputthecalendar.3.NewYearDay一Da
4、yonwhichJan1stfoils.Forexample,for2006,itwouldbeSunday.YearshouldbeusedtocheckwhetheritisaLeapyearornot.YYYYisleapyeariffollowingtwoconditionshold:•shouldbeperfectlydivisibleby4.•Ifitisdivisibleby100thenitshouldnotbedivisibleby400.NewYearDay(NYD)isrequiredsothatyoucancalc
5、ulatethestartingdayoftherequiredmonthi.e.,unlessyouknowthatyear2006startswithSunday,youwillnotbeabletoknowthatMay2006startswithMonday.FormatofInput•Year-YYYY(Ex:1999)•Month一MM(Ex:11,04or4.Leadingzeroisoptionali.e.,userhasachoicetoentereither04or4)•NewYearDay(NYD)一Oneofthe
6、followingcharactersM-MondayT-TuesdayW一WednesdayR-ThursdayF一FridayS-SaturdayU-SundayAppropriateerrorshouldberaisedifanyoftheinputisnotinthecorrectformat•Examplesofbadinputare:99foryear,15formonth,“T,forNYD.ExampleInput&OutputYear:2006Month:06NYD:ROutput:SuMoTuWeThFrSa12345
7、67891011121314151617181920217?2324252627282930Year:2008Month:4NYD:TOutput:SuMoTuWeThFrSa134567891011121314151617181920217?2324252627282930RequirementsoftheProgramThoughthisprogramcanbedonewithoutusingC++featuresorclasses,sinceitisaC++course,youSHOULDuseclassesandobjectsto
8、code.Tobespecific,Ineedyoutohavetwoclasseswithdatamembers:・DatenDay-Number(1..31)sDay-Day(U/M/T/
此文档下载收益归作者所有