上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 33 下一页
  2021年8月14日
摘要: 1 //string字符串拼接 2 #include <iostream> 3 #include<string> 4 5 using namespace std; 6 7 8 void test01() 9 { 10 string str1 = "我"; 11 12 str1 += "爱学习"; 1 阅读全文
posted @ 2021-08-14 07:35 Bytezero! 阅读(1923) 评论(0) 推荐(0)
  2021年8月13日
摘要: 1 //vector容器嵌套容器 2 #include <iostream> 3 #include <string> 4 #include<fstream> 5 #include<vector> 6 #include<algorithm> 7 using namespace std; 8 9 voi 阅读全文
posted @ 2021-08-13 17:43 Bytezero! 阅读(477) 评论(0) 推荐(0)
摘要: 1 //vector存放自定义数据类型 2 3 #include <iostream> 4 #include <string> 5 #include<fstream> 6 #include<vector> 7 #include<algorithm> 8 using namespace std; 9 阅读全文
posted @ 2021-08-13 17:20 Bytezero! 阅读(331) 评论(0) 推荐(0)
摘要: 1 //STL初始 2 // 3 //vector容器存放内置数组 4 5 #include <iostream> 6 #include <string> 7 #include<fstream> 8 using namespace std; 9 #include<vector> 10 #includ 阅读全文
posted @ 2021-08-13 15:12 Bytezero! 阅读(863) 评论(0) 推荐(0)
摘要: 1 //模板案例-数组封装类 2 //描述 3 //实现一个通用的数组类 4 //1.可以对内置数据类型以及自定义数据类型的数据进行储存 5 //2.将数组很脏的数据储存到堆区 6 //3.构造函数中可以传入数组的容量 7 //4.提供对应的拷贝构造函数以及operator=防止浅拷贝问题 8 // 阅读全文
posted @ 2021-08-13 13:52 Bytezero! 阅读(204) 评论(0) 推荐(0)
摘要: 1 //类模板与友元 2 //全局函数类内实现 -直接在类内声名由于即可 3 //全局函数类外实现 -需要提前让编译器知道全局函数的存在 4 5 #include <iostream> 6 #include <string> 7 #include<fstream> 8 using namespace 阅读全文
posted @ 2021-08-13 10:40 Bytezero! 阅读(236) 评论(0) 推荐(0)
摘要: 1 //第一种方式被注释 2 //未被注释是第二种方式 3 //类模板分文件编写问题及解决 4 5 6 #include <iostream> 7 #include <string> 8 #include<fstream> 9 //第一中解决方式 直接包含源文件 10 //#include"pers 阅读全文
posted @ 2021-08-13 09:42 Bytezero! 阅读(136) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 #include <string> 3 #include<fstream> 4 using namespace std; 5 6 template<class T1,class T2> 7 class Person 8 { 9 public: 10 / 阅读全文
posted @ 2021-08-13 09:38 Bytezero! 阅读(132) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 #include <string> 3 #include<fstream> 4 using namespace std; 5 6 7 //类模板与继承 8 template<class T> 9 class Base 10 { 11 12 T m; 1 阅读全文
posted @ 2021-08-13 09:37 Bytezero! 阅读(100) 评论(0) 推荐(0)
摘要: 1 //类模板对象做函数参数 2 //三种方式 3 //1.指定传入的类型 --直接显示对象的数据类型 4 //2.参数模板化 --将对象中的参数变为模板进行传递 5 //3.整个类模板化 --将这个对象类型 模板化进行传递 6 7 8 #include <iostream> 9 #include 阅读全文
posted @ 2021-08-13 09:36 Bytezero! 阅读(103) 评论(0) 推荐(0)
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 33 下一页