C++_Prime_Plus
文章平均质量分 53
Edition six
Raywit
这个作者很懒,什么都没留下…
展开
-
C++ Primer Plus 第十三章知识点(一)
C++ Primer Plus 第十三章知识点简化1. 简单的基类2. 派生一个类3. 派生类和基类的特殊关系Reference:1. 简单的基类 由于面向对象编程主要目的之一就是提供可重写的代码,对于扩展和修改类,除了去源码中修改之外,还有就是类继承;从一个类派生出另一个类时,原始类称为 基类,继承类称为 派生类。简单看下下面的程序:#ifndef HEAD_H_#define HEAD_H_#include<原创 2021-02-14 23:25:32 · 198 阅读 · 0 评论 -
C++ Primer Plus 第十二章知识点(一)
C++ Primer Plus 第十二章知识点简化1. 动态内存和类1. 动态内存和类归纳点:静态成员变量初始化习惯加const 每个成原创 2021-01-20 15:23:09 · 295 阅读 · 0 评论 -
C++ Primer Plus 第十一章知识点(一)
C++ Primer Plus 第十一章知识点简化1. 类的运算符重载2. 友元3. 友元的拓展1. 类的运算符重载 对于重载(多态)之前也提到过,这一部分主要是讲述类的重载以及注意点。#ifndef TIME_H_#define TIME_H_class Time{private: int hours; int minutes;public: Time(); Time(int h, int m = 0原创 2021-01-20 15:22:56 · 156 阅读 · 0 评论 -
C++ Primer Plus 第十章知识点(二)
C++ Primer Plus 第十章知识点简化1. this指针2. 抽象数据类型Reference:1. this指针归纳点:this的含义与使用习惯加const 每个成员函数都有一个 this指针,该指针指向调用对象,若需要引用整个对象则使用*this(因为this是对象的地址,所以返回对象用*this),这一部分内容是怎么来的呢?先思考一个问题: &nb原创 2021-01-19 10:11:43 · 130 阅读 · 0 评论 -
C++ Primer Plus 第十章知识点(一)
C++ Primer Plus 第十章知识点简化1. 头文件与类的介绍2. 构造函数与析构函数Reference:1. 头文件与类的介绍归纳点:头文件类的组成部分 头文件有个格式叫防卫式声明,即#ifndef XX_H_、#define XX_H_、#endif。#ifndef STOCK_H_#define STOCK_H_#include <string>using namespac原创 2021-01-19 10:11:31 · 1008 阅读 · 4 评论 -
C++ Primer Plus 第八章知识点(二)
C++ Primer Plus 第八章知识点简化1. 缺省值2. 重载3. 模板Reference:1. 缺省值归纳点:缺省值的使用;#include <iostream>using namespace std;const int ArSize = 80;char* left(const char * str, int n=1); // 只用在该处写上默认值int main(){ char sample[ArSize]; cout << "En原创 2021-01-19 10:11:20 · 169 阅读 · 0 评论 -
C++ Primer Plus 第八章知识点(一)
C++ Primer Plus 第八章知识点简化1. inline 内联函数2. 引用变量Reference:1. inline 内联函数归纳点:inline函数优点及原理内联与宏的区别 (自行阅读见p255) 内联函数是为了提高运行速度做的一项改进,其原理以及常规函数与内联函数之间的区别如下图所示:对于常规函数,需要跳转到另一个位置去执行完代码,然后再跳转回来,这个就会多一个处理函数调用机制时间,而内原创 2021-01-19 10:11:08 · 177 阅读 · 0 评论 -
C++ Primer Plus 第六版 第七章练习答案
C++ Primer Plus 第六版 第七章练习答案if else循环;?:条件运算符;switch语句;break、continue循环;提高读取的鲁棒性;文件输入与输出。#include <iostream>using namespace std;// practice 7.1double average(double x, double y) { return 2.0*x*y / (x + y);}void p7_1(void)原创 2021-01-19 10:10:51 · 184 阅读 · 0 评论 -
C++ Primer Plus 第六版 第四章练习答案
C++ Primer Plus 第六版 第四章练习答案数组初始化;字符串操作;string用法;结构数组;指针;vector;array。#include <iostream>#include<string>using namespace std;//practice 4.1void p4_1(void) { string first; char* last = new char; int age; char gra原创 2021-01-19 10:10:36 · 243 阅读 · 1 评论 -
C++ Primer Plus 第六版 第二章练习答案
C++ Primer Plus 第六版 第二章练习答案#include <iostream>using namespace std;// practice 2.1void p2_1(void){ cout << "Raywit" << endl; cout << "China\n"; return;}// practice 2.2void p2_2(void){ int Longs = 0; int Yards = 0; cou原创 2021-01-19 10:10:22 · 171 阅读 · 0 评论 -
C++ Primer Plus 第六版 第三章练习答案
C++ Primer Plus 第六版 第三章练习答案变量名要求;sizeof() 和 头文件climits;–> SHRT_MAX–> USHRT_MAX数据溢出 (轮回);多进制使用与表示;const限定符;float表示格式:+5.4E+16;强制转换的格式:–> (typename) value–> typename (value)–> static_cast<typename> (value)aut原创 2021-01-19 10:10:09 · 213 阅读 · 0 评论 -
C++ Primer Plus 第六版 第五章练习答案
C++ Primer Plus 第六版 第五章练习答案for循环;while循环;do while循环;基于范围的for循环;#include <iostream>using namespace std;//practice 5.1void p5_1(void) { int number1, number2, sum = 0; cout << "Please enter the first number: "; cin >>原创 2021-01-19 10:01:01 · 163 阅读 · 0 评论 -
C++ Primer Plus 第六版 第六章练习答案
C++ Primer Plus 第六版 第六章练习答案if else循环;?:条件运算符;switch语句;break、continue循环;提高读取的鲁棒性;文件输入与输出。#include <iostream>using namespace std;//practice 6.1#include <cctype>void p6_1(void) { char ch; while ((ch = cin.get()) != '@原创 2021-01-19 10:01:26 · 167 阅读 · 0 评论