
C++学习
m0_49225991
这个作者很懒,什么都没留下…
展开
-
OPP第二篇
**管理指针成员**三种方法- 1.常规指针类(浅复制)严重缺点:野指针(悬垂指针)- 2.智能指针类(计数类)避免野指针(悬垂指针)- 3.值型类(深复制)#pragma once//常规指针类class AHasPtr {public: AHasPtr( int* p, int i) :ptr(p), val(i) {} int* get_ptr() const { return ptr; } int get_int() const { return val;...原创 2020-12-18 22:27:23 · 547 阅读 · 0 评论 -
OPP中级
C++快速入门编写简单的C++程序输入和输出标准输入对象标准输出对象控制结构while 语句for 语句if 语句类的简介c++程序示例:销售图书一、demo.cppint main(){ return 0;}输入和输出.cpp#include<iostream>//coutint main(){ std::cout << "Hello,world!"<<std::endl<< std::endl原创 2020-12-13 20:19:52 · 158 阅读 · 1 评论 -
通讯录管理系统
- 通讯录管理系统-–菜单功能通讯录管理系统--退出功能通讯录管理系统–添加联系人设计联系人结构体设计通讯录结构体main函数中创建通讯录封装添加联系人函数测试添加联系人功能通讯录管理系统-显示联系人注意:用本地Windows调试器运行代码 很快...原创 2020-12-10 10:27:24 · 131 阅读 · 0 评论 -
机房预约系统
1.搭建界面#include<iostream>using namespace std;int main(){ int select = 0;//用于接收用户的选择 while (true) { cout << "==================欢迎来到传智客机房预约系统===============" << endl; cout << endl << "请输入您的身份" << endl; co原创 2020-12-08 21:44:53 · 535 阅读 · 1 评论 -
c++primer 第五版 第九章顺序容器
ex9.2#include<iostream>#include<list>#include<deque>using namespace std;int main(){ list<deque<int>>ldi; return 0;}ex9.4#include<iostream>#include<list>#include<deque>//双端队列 顺序容器#include<v原创 2020-12-07 10:29:26 · 126 阅读 · 0 评论 -
c++primer 第五版 第七章 抽象数据类型
#include<iostream>#include<string>using namespace std;struct Sales_data //类{ //新成员 string isbn() const { return bookNo; }//ISBN编号 Sales_data& combine(const Sales_data&);//将Sales_data对象加到另一个对象上 double avg_price() const; //数据成员原创 2020-12-03 21:48:44 · 188 阅读 · 0 评论 -
C++ primer plus第八章
内联函数内联函数头文件.h//内联函数头文件.h#ifndef DEMO_H#define DEMO_H#include<string>//带有inline的函数叫内联函数(执行速度快)(短小的函数)inline int sum(int a, int b){ return a + b;}inline const std::string& shortString(const std::string& s1, const std::string&原创 2020-11-30 21:50:55 · 165 阅读 · 0 评论 -
第7章 函数C++的编程模块
函数定义#include<iostream>using namespace std;class Date{};void process()//void这是没有参数的函数{}bool is_present(int * x, int y);Date& calendar(const char * s);//x的y次方 形参int power(int x, int y)//这是一个函数{ int result = 1; for (int loo原创 2020-11-25 11:52:10 · 242 阅读 · 0 评论 -
第6章 分支语句和逻辑运算符
//if.cpp--using the if statement#include<iostream>int main(){ using namespace std; char ch; int spaces = 0; int total = 0; cin.get(ch); while (ch != '.') { if (ch == ' ')//空字符的在引号中间 加一个空格 ++spaces;原创 2020-11-19 21:01:28 · 156 阅读 · 0 评论 -
C++ Primer Plus第二章笔记
## C++ Primer Plus第二章一、2.1 进入C++1.main()函数2.名称空间3.头文件名4.使用cout进行C++输出5.控制符endl6.换行符7.C++源代码格式化二、C++语句一、2.1 进入C++1.main()函数2020年10月28日正式开始阅读C++ Primer Plus。学习计算机语言时,应从程序的基本结构开始学起。程序的基本结构如下:int main(){ statements return 0;}这几行代码构成了函数的定义.原创 2020-10-30 21:25:43 · 393 阅读 · 0 评论