C++上机实验报告 实验一

C++上机实验报告 实验一

ID:38256579

大小:1.28 MB

页数:10页

时间:2019-06-06

C++上机实验报告 实验一_第1页
C++上机实验报告 实验一_第2页
C++上机实验报告 实验一_第3页
C++上机实验报告 实验一_第4页
C++上机实验报告 实验一_第5页
资源描述:

《C++上机实验报告 实验一》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、实验一Exercise11.实验目的1.熟悉MicrosoftVisualC++6.0集成开发环境2.学习创建控制台应用程序项目3.编辑源程序4.编译和调试程序2.实验要求1.熟悉程序开发环境2.编辑源程序3.编译并调试程序3.实验内容1.熟悉MicrosoftVisualStudio6.0的开发环境2.编辑并调试下面的程序注:工程中的文件包括三个:TimeType.h、TimeType.cpp、Diary.cpp4.源程序classTimeType{public:voidSet(inthours,intminutes,intseconds);voidIncrement

2、();voidWrite();//const;boolEuqal(TimeTypeotherTime);//const;boolLessThan(TimeTypeotherTime);//const;private:inthrs;intmins;intsecs;};#include"TimeType.h"#includeusingnamespacestd;voidTimeType::Set(inthours,intminutes,intseconds){hrs=hours;mins=minutes;secs=seconds;}//Set()voidT

3、imeType::Increment(){secs++;if(secs>59){secs=0;mins++;if(mins>59){mins=0;hrs++;if(hrs>23)hrs=0;}}}//Increment()voidTimeType::Write()//const{cout<

4、rs==otherTime.hrs&&mins==otherTime.mins&&secs==otherTime.secs);}boolTimeType::LessThan(TimeTypeotherTime)//const{return(hrs

5、

6、hrs==otherTime.hrs&&mins

7、

8、hrs==otherTime.hrs&&mins==otherTime.mins&&secs#include"TimeType.h"usingn

9、amespacestd;intmain(){TimeTypetime;TimeTypeothertime;inthours;intminutes;intseconds;cout<<"Enteratime(usehours<0toquit):";cin>>hours>>minutes>>seconds;while(hours>=0)//while(hours>=0){time.Set(hours,minutes,seconds);time.Increment();//设置时间量cout<<"Incrementedtimeis";time.Write();//输出时间cou

10、t<>hours>>minutes>>seconds;//输入另一个时间量othertime.Set(hours,minutes,seconds);if(time.Euqal(othertime))//判断两个时间的大小关系cout<<"timeisequaltoothertime"<

11、rethantoothertime"<

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。