ImageVerifierCode 换一换
格式:DOCX , 页数:10 ,大小:17.03KB ,
资源ID:4624406      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/4624406.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(实验报告模板C++实验报告.docx)为本站会员(b****4)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

实验报告模板C++实验报告.docx

1、实验报告模板C+实验报告【实验报告模板】C+实验报告各位读友大家好,此文档由网络收集而来,欢迎您下载,谢谢C+实验报告实验1-1过程化编程【实验目的】理解、掌握过程化编程程序设计思想。【实验内容】1.程序填空,练习类、对象、继承的定义和实现方法。2.根据程序运行结果,补充完整程序。【实验要求】我们在进行英语阅读的时候,会发现一个有趣的现象:有些字串是左右对称的,如madam。我们把这种字串称为symmetry text 即“对称文”。现在有若干航字串,每一行可以由数字、标点符号、空格符以及英文字符(包括大小写)组成。要你帮忙编程判断是否是对称文,否则,就不能最大限度地发现有趣现象了。输入说明每

2、个字串为一行,每行结束以回车符为标志,可能有上百上千行业说不定。当字串为“000000”时,输入结束。英文字符不区分大小写,即Madam亦为对称文。不要忘了“”也是互为对称的。输出说明如果是对称文,则输出“Symmetry”,否则输出“Not symmetry”。每个结论占一行。图 1 图 2【程序代码】 #include#includeusing namespace std;bool isMatch(string s);int main() bool isMatch(string s) else if (si = A&si = a&slen - i - 1 = a&si = A&slen -

3、 i - 1 s;if (“000000”) = 0) if (isMatch(s) else cout ) else if (si = &slen - i - 1 = ) else if (si = (&slen - i - 1 = ) else if (si!= slen - i - 1) return false;continue;continue;continue;continue;return true;【运行结果】图 3 实验一运行结果实验1-2面向对象编程技术(1)最全面的范文参考写作网站【实验目的】理解面向对象的的程序设计思想。【实验内容】定义一个时间类Time,能提供和设置由

4、时、分、秒组成的时间,并编出应用程序,要求包括定义时间对象,设置时间,输出该对象提供的时间。并请将类定义作为界面,用多文件结构实现之。【程序代码】 /#includeclass Time public:;/#include “#includevoid Time:inputT()begin:int a,b,c;std:couta b c;if (c 60 | c 60 | b 24 | a p;if (p = n| p = N) std:cout C+实验报告 begin1:int a,b,c;std:cout a b c;if (c 60 | c 60 | b 24 | a void main

5、(void) Time time1;();();();(); std:cout #include#includeusing namespace std;class Vector;Vector:Vector(int s)Vector:Vector(const Vector&s) int i;sz = ;v = new intsz;for (i = 0;i= sz) return vi;cerr C+实验报告 int i,j;ifstream in(“);/文件名 int x,y;in x y;Matrix ma(x,y);for (i = 0;i(i,j);in x;Vector ve(x);f

6、or (i = 0;ivei;【实验结果】图 5 实验三运行结果实验4面向对象程序设计(3)【实验要求】请在程序中的日期类的基础上,实现一个可以进行加天数操作获得另一个日期,以及进行日期减日期操作获得相隔天数的日期类,并进行应用程序设计:创建和两个日期,并计算中间相隔的天数,前者加上300天会是什么日子呢?范文TOP100【实验程序】 一、头文件部分#pragma once/class Date with year-month-day version#include#includeusing namespace std;class Date ;二、函数定义 int year,month,day

7、;Date(int n = 1) int ymd2i()const;void i2ymd(int n);static const int tians;Date(const string&s);Date(int y,int m,int d):year(y),month(m),day(d) Date operator+ (int n)const Date&operator+=(int n) Date&operator+() int operator-(Date&d)const bool isLeapYear()const friend ostream&operator#include#includ

8、eusing namespace std;const int Date:tians = 0,31,59,90,120,151,181,212,243,273,304,334 ;const int Y400 = 146097;/number of days of 400 yearsconst int Y100 = 36524;/number of days of 100 yearsconst int Y4 = 1461;/number of days of 4 yearsDate:Date(const string&s) (转载于: 在点 网)void Date:i2ymd(int absDay

9、) int Date:ymd2i()const int yearDay = (year - 1) * 365 + (year - 1) / 4 - (year - 1) / 100 + (year - 1) / 400;return yearDay + tiansmonth - 1 + (isLeapYear() &month 2) + day;year = absDay / Y400 * 400;int y = absDay%Y400;/被400年除得的天数 if (y = Y400 - 1) year += y / Y100 * 100;y %= Y100;year += y / Y4 *

10、 4;y%=Y4;if (y = Y4 - 1) year += y / 365;y %= 365;if (y = 0) year+;bool leap = isLeapYear();for (month = 1;monthtiansmonth + (month = 2 &leap);month+);day = y - tiansmonth - 1;month = 12,day = 31;return;month = 12,day = 30;return;month = 12,day = 30;return;year = atoi(0,4).c_str();month = atoi(5,2).

11、c_str();day = atoi(8,2).c_str();ostream&operatorusing namespace std;int main() Date d1(2005,8,21);Date d2(2008,8,8);cout#includeusing namespace std;class Date ;int year,month,day;static const int tians;Date(int n = 1) int ymd2i( )const;void i2ymd(int n);Date(const string&s );Date(int y,int m,int d)

12、:year(y),month(m),day(d) Date operator+(int n)const Date&operator+=(int n) Date&operator+() int operator-(Date&d)const bool isLeapYear()const friend ostream&operatorC+实验报告二、头文件#pragma once/#include”“#include#includeusing namespace std;class WDate :public Date protected:WDate operator+(int n) const r

13、eturn Date:operator+(n); WDate&operator+=(int n) Date:operator+=(n);return *this; WDate&operator+() return *this += 1; int getWeekDay() return ymd2i() % 7;/0:Sunday,1:Monday,etc.int operator-(WDate&wd)const return ymd2i() - (); friend ostream&operator#include#includeusing namespace std;const int Dat

14、e:tians = 0,31,59,90,120,151,181,212,243,273,304,334 ;const int Y400 = 146097;/number of days of 400 yearsconst int Y100 = 36524;/number of days of 100 yearsconst int Y4 = 1461;/number of days of 4 yearsDate:Date(const string&s) void Date:i2ymd(int absDay) year = absDay / Y400 * 400;int y = absDay%Y

15、400;/被400年除得的天数 if (y = Y400 - 1) month = 12,day = 30;year = atoi(0,4).c_str();month = atoi(5,2).c_str();day = atoi(8,2).c_str(); return;year += y / Y100 * 100;y %= Y100;year += y / Y4 * 4;y %= Y4;if (y = Y4 - 1) year += y / 365;y %= 365;if (y = 0) year+;bool leap = isLeapYear();for (month = 1;month

16、tiansmonth + (month = 2 &leap);month+);day = y - tiansmonth - 1;month = 12,day = 31;return;month = 12,day = 30;return;int Date:ymd2i()const ostream&operator2) + day;四、/Class WDate with year-month-day Version#include”“#includeusing namespace std;ostream&operatorusing namespace std;int main() WDate d1(2005,8,21);WDate d2(2008,8,8);cout d1 ”n”;cout d2 ”n”;【实验结果】上页各位读友大家好,此文档由网络收集而来,欢迎您下载,谢谢

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1