紫金学院C++考试范围预估_第1页
紫金学院C++考试范围预估_第2页
紫金学院C++考试范围预估_第3页
紫金学院C++考试范围预估_第4页
紫金学院C++考试范围预估_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、范围预估一、 选择题。(2*10)1、3道面向过程(第三章至第六章),其中2道与指针有关。2、7道面向对象(第八章到第十二章),大致重点:运算符重载、析构、构造、和友元等。注:均来自习题集。二、 填空题。(1*10)涉及考点:结构体(第七章:给结构体成员赋值)、三种继承方式后的权限类型(第十一章)、多态(第十二章:实现手段、区别),字符串函数(第五章:strlen、strcpy等)。注:主要参考习题集并大致了解书本介绍。三、 判断题。(1*5)习题集第八章至第十二章中判断题选其中5道,大概都细看之。四、 程序填空。(2*10)1、 友元。(下为可能出现的原题)2、 构造函数。(下为可能出现的原

2、题)五、 填结果。(5*5)1、 不同存储类型对象调用构造、析构原则2、 派生类,构造函数调用顺序六、 编程题。(10*2)1、 上机题(书本十一章9)2、 #include 3、 #include 4、 using namespace std;5、 class Teacher6、 7、 public:8、 Teacher(string na, int a, string sex, string tit, string ad, string t);9、 void display();10、11、 protected:12、 string name;13、 int age;14、 string

3、sex;15、 string title;16、 string addr;17、 string tel;18、 ;19、 Teacher:Teacher(string na, int a, string sex, string tit, string ad, string t) : name(na), age(a), sex(sex), title(tit), addr(ad), tel(t) 20、 void Teacher:display()21、 22、 cout name: name endl;23、 cout age: age endl;24、 cout sex: sex endl;

4、25、 cout title: title endl;26、 cout address: addr endl;27、 cout tel: tel endl;28、 29、 class Cadre30、 31、 public:32、 Cadre(string na, int a, string sex, string p, string ad, string t);33、 void display();34、35、 protected:36、 string name;37、 int age;38、 string sex;39、 string post;40、 string addr;41、 st

5、ring tel;42、 ;43、 Cadre:Cadre(string na, int a, string sex, string p, string ad, string t) : name(na), age(a), sex(sex), post(p), addr(ad), tel(t) 44、 void Cadre:display()45、 46、 cout name: name endl;47、 cout age: age endl;48、 cout sex: sex endl;49、 cout post: post endl;50、 cout address: addr endl;5

6、1、 cout tel: tel endl;52、 53、 class Teacher_Cadre : public Teacher, public Cadre54、 55、 public:56、 Teacher_Cadre(string na, int a, string sex, string tit, string p, string ad, string t, float w);57、 void show();58、59、 private:60、 float wage;61、 ;62、 Teacher_Cadre:Teacher_Cadre(string na, int a, stri

7、ng sex, string t, string p, string ad, string tel, float w) : Teacher(na, a, sex, t, ad, tel), Cadre(na, a, sex, p, ad, tel), wage(w) 63、 void Teacher_Cadre:show()64、 65、 Teacher:display();66、 cout post: Cadre:post endl;67、 cout wages: wage endl;68、 69、 int main()70、 71、 Teacher_Cadre72、 xiaoming(小明

8、, 25, 男, 高级工程师, 开发工程师, 南京, , 1234.5);73、 xiaoming.show();74、 return 0;75、 12.476、 #include 77、 using namespace std;78、 class Shape79、 80、 public:81、 virtual double area() const = 0;82、 ;83、 class Circle : public Shape84、 85、 public:86、 Circle(double r) : radius(r) 87、 virtual double area() const ret

9、urn 3.14159 * radius * radius; ;88、89、 protected:90、 double radius;91、 ;92、 class Rectangle : public Shape93、 94、 public:95、 Rectangle(double w, double h) : width(w), height(h) 96、 virtual double area() const return width * height; 97、98、 protected:99、 double width, height;100、 ;101、 class Triangle

10、: public Shape102、 103、 public:104、 Triangle(double w, double h) : width(w), height(h) 105、 virtual double area() const return 0.5 * width * height; 106、107、 protected:108、 double width, height;109、 ;110、 void printArea(const Shape &s)111、 112、 cout s.area() endl;113、 114、115、 int main()116、 117、 Ci

11、rcle circle(12.6);118、 cout area of circle =;119、 printArea(circle);120、 Rectangle rectangle(4.5, 8.4);121、 cout area of rectangle =;122、 printArea(rectangle);123、 Triangle triangle(4.5, 8.4);124、 cout area of triangle =;125、 printArea(triangle);126、 return 0;127、 12.5128、 #include 129、 using namesp

12、ace std;130、 class Shape131、 132、 public:133、 virtual double area() const = 0;134、 ;135、 class Circle : public Shape136、 137、 public:138、 Circle(double r) : radius(r) 139、 virtual double area() const return 3.14159 * radius * radius; ;140、141、 protected:142、 double radius;143、 ;144、 class Square : p

13、ublic Shape145、 146、 public:147、 Square(double s) : side(s) 148、 virtual double area() const return side * side; 149、150、 protected:151、 double side;152、 ;153、154、 class Rectangle : public Shape155、 156、 public:157、 Rectangle(double w, double h) : width(w), height(h) 158、 virtual double area() const

14、 return width * height; 159、160、 protected:161、 double width, height;162、 ;163、164、 class Trapezoid : public Shape165、 166、 public:167、 Trapezoid(double t, double b, double h) : top(t), bottom(t), height(h) 168、 virtual double area() const return 0.5 * (top + bottom) * height; 169、170、 protected:171

15、、 double top, bottom, height;172、 ;173、174、 class Triangle : public Shape175、 176、 public:177、 Triangle(double w, double h) : width(w), height(h) 178、 virtual double area() const return 0.5 * width * height; 179、180、 protected:181、 double width, height;182、 ;183、 int main()184、 185、 Circle circle(12.6);186、 Square square(3.5);187、 Rectangle rectangle(4.5, 8.4);188、 Trapezoid trapezoid(2.0, 4.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论