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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

本文(程序设计II复习总结.doc)为本站会员(rav7596)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

程序设计II复习总结.doc

1、程序设计 II 学习内容复习总结part1、结构体与递归程序设计方法1、结构体类型-用户(就是我们)可以根据问题需要自己构造的一种具有反映事物内部关联属性的构造性数据类型。比如,时间struct Timeint hour;int min;int sec;Time t1,t2;Time *tp;t1.hour=8;t1.min=8;t1.sec=8;t2=t1;/2 个结果体变量可以直接整体赋值。和同一个类的 2 个对象可以直接赋值一样。 (考虑如果成员里面有数组呢?)tp=tp-hour+;/实际上是让 t2 的时间属性中的小时到 9 点。/ to test struct 2 objects

2、assign value globally#include #define N 10struct mystructint no;int idN;void main()struct mystruct t1=1,1,2,3,4,5,6,t2;struct mystruct* tp1,*tp2;int i;printf(“now output t1 :n“);for(i=0;iidi+;printf(“n now output t1 :n“);for(i=0;iidi+=2;printf(“n now output t1 :n“);for(i=0;imax2) return max1;else re

3、turn max2;part2、类、对象、继承、动态性、运算符重载1、 类与对象类也是用户根据问题需要自己定义的复合数据类型,为了封装、移植、重用的需要。它与结构体最大的不同是里面提供了接口函数,如果没有接口函数就不用类了。再一点就是它能够派生儿子和孙子,而结构体不能。最后,结构体的成员都是 public,而多数类数据成员都是private.2、 定义一个类。class Person char Name20;char Sex;int Age;public:void Register(char *name, int age, char sex) strcpy(Name, name);Age =

4、age;Sex = (sex = m?m:f);void ShowMe() cout = 1 class Datepublic:int day, month, year;void init(int,int,int);void print_ymd();void Date:init(int yy, int mm, int dd) year = yy;month = mm;day = dd;void Date:print_ymd() cout init(2006,3,28);p1-print_ymd();int * p2;p2 = /指向对象数据成员的指针cout using namespace s

5、td;class Complex double real, imag;public:Complex(double r = 0, double i = 0): real(r), imag(i)double Real()return real;double Imag()return imag;Complex operator +(ComplexComplex operator +(double);Complex operator =(Complex);Complex Complex:operator + (Complex temp.real = real+c.real;temp.imag = im

6、ag+c.imag;return temp;Complex Complex:operator + (double d) / 重载运算符 Complex temp;temp.real = real+d;temp.imag = imag;return temp;Complex Complex:operator = (Complex c) / 重载运算符 real = c.real;imag = c.imag;return *this;/ 测试主函数int main() Complex c1(3,4),c2(5,6),c3;cout void Point:setpoint(int r,int c)x

7、=r;y=c;void Point:print(void)coutxydouble Rectangle:getlength(void)int tx1,tx2;tx1=lefttop.getx();tx2=rightbottom.getx();return tx2-tx1;double Rectangle:getwidth(void)int ty1,ty2;ty1=lefttop.gety();ty2=rightbottom.gety();return tx1-tx2;double Rectangle:area(void)int len,wid;len=getlength();wid=getwidth();return len*wid;void Rectangle:print() cout “Left Top Vertex = “;Point:print();cout “; Length = “ getlength() “, Wigth = “ getwidth() endl;

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报