![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++笔记
NAND_LU
~
展开
-
C++深拷贝与浅拷贝
C++深拷贝与浅拷贝 #include<iostream> #include<string> using namespace std; //深拷贝与浅拷贝 //浅拷贝就是利用默认的拷贝函数,容易带来堆区的内存重复释放问题 class Person { public: int m_Age; int *m_Height; Person() { cout << "Person的默认构造函数调用" << endl; } Person(int原创 2021-08-30 11:47:33 · 88 阅读 · 0 评论 -
C++cout输出string格式
C++cout输出string格式 #include<iostream> using namespace std; string Name=“张三”; cout<<Name<<endl;//报错。 //想要正确输出加上 #include<string> 错误 C2679 二进制“<<”: 没有找到接受“std::string”类型的右操作数的运算符(或没有可接受的转换) ...原创 2021-08-29 16:31:36 · 84 阅读 · 0 评论 -
C++实现一个简单的链表
#include<iostream> using namespace std; //用结构体来表示一个节点 typedef struct node { int age; char name[20]; struct node *next; }Student; //创建链表 Student* createList(int n) { Student * head = new Student;//头结点 Student *pre = head; for (int i = 0原创 2021-08-25 15:08:57 · 91 阅读 · 0 评论