随笔分类 - 重学C++
摘要:1 #include<iostream> 2 #include<cstdlib> 3 using namespace std; 4 #include<map> 5 6 7 /* 8 3.9 map/multimap容器 9 10 3.9.1 map基本概念 11 12 简介: 13 map中所有元素
阅读全文
摘要:1 #include<iostream> 2 #include<cstdlib> 3 using namespace std; 4 #include<set> 5 #include<string> 6 7 8 /* 9 3.8.8 set容器的排序 10 11 学习目标:set容器默认排序规则为从小
阅读全文
摘要:1 #include<iostream> 2 #include<cstdlib> 3 using namespace std; 4 #include<set> 5 #include<string> 6 7 8 /* 9 3.8.6 set和multiset区别 10 11 set不可以插入重复数据,
阅读全文
摘要:1 #include<iostream> 2 #include<cstdlib> 3 using namespace std; 4 #include<set> 5 6 7 /* 8 3.8.3 set容器大小和交换 9 10 size(); //返回容器中元素的数目 11 empty(); //判断
阅读全文
摘要:#include<iostream> #include<cstdlib> using namespace std; #include<set> /* 3.8 set/multiset容器 3.8.1 set基本概念 简介:所有元素都会在插入时自动被排序 本质:set/multiset属于关联式容器,
阅读全文
摘要:#include<iostream> #include<cstdlib> using namespace std; #include<list> #include<string> /* 3.7.8 list容器的排序案例 案例描述:将Person自定义数据类型进行排序,Person中属性有姓名、年龄
阅读全文
摘要:#include<iostream> #include<cstdlib> using namespace std; #include <list> #include<algorithm> /* 3.7.6 list容器数据存取 front(); //返回第一个元素。 back(); //返回最后一个
阅读全文
摘要:#include<iostream> #include<cstdlib> using namespace std; #include <list> /* 3.7.5 list 插入和删除 push_back(elem);//在容器尾部加入一个元素 pop_back();//删除容器中最后一个元素 p
阅读全文
摘要:#include<iostream> #include<cstdlib> using namespace std; #include <list> /* 3.7.3 list赋值和交换 给list容器进行赋值,以及交换list容器 assign(beg, end); //将[beg, end)区间中
阅读全文
摘要:#include<iostream> #include<cstdlib> using namespace std; #include<list> /* 3.7 list容器 3.7.1 list容器基本概念 功能:将数据进行链式存储 链表(list)是一种物理存储单元上非连续的存储结构,数据元素的逻
阅读全文
摘要:#include<iostream> #include<cstdlib> using namespace std; #include<queue> /* 3.6 queue容器 队列queue是一种先进先出(First In First Out,FIFO)的数据结构,它有两个出口 队列容器允许从一端
阅读全文
摘要:#include<iostream> #include<cstdlib> using namespace std; #include<stack> /* 3.5 stack容器 栈stack是一种先进后出(First In Last Out,FILO)的数据结构,它只有一个出口 栈中只有顶端的元素才
阅读全文
摘要:#include<iostream> //#include<stdlib.h> #include<cstdlib> // 效果同上 using namespace std; #include<string> #include<vector> #include<deque> #include<algo
阅读全文
摘要:1 #include<iostream> 2 #include<stdlib.h> 3 using namespace std; 4 #include<deque> 5 #include<algorithm> 6 7 8 /* 9 3.3.6 deque数据存取 10 at(int idx); //
阅读全文
摘要:1 #include<iostream> 2 #include<stdlib.h> 3 using namespace std; 4 #include<deque> 5 6 7 /* 8 3.3.5 deque插入和删除 9 两端插入操作: 10 push_back(elem); //在容器尾部添加
阅读全文
摘要:1 #include<iostream> 2 #include<stdlib.h> 3 using namespace std; 4 #include<deque> 5 6 7 /* 8 3.3.3 deque赋值操作 9 deque& operator=(const deque &deq); //
阅读全文
摘要:课程来源 黑马程序员匠心之作|C++教程从0到1入门编程,学习编程不再难 学习进程 第1阶段-C++基础入门(2-6)PDF 1 初识C++、数据类型、运算符 2 流程控制语句 2.1【选择结构:if、三目运算符、switch】 2.2【while循环、案例】 2.3【do while循环、案例】
阅读全文
摘要:1 #include<iostream> 2 #include<stdlib.h> 3 using namespace std; 4 #include<deque> 5 6 7 /* 8 3.3 deque容器 9 3.3.1 deque基本概念 10 双端数组,可以对头端进行插入删除操作(类似于队
阅读全文
摘要:#include<iostream> #include<stdlib.h> #include<string> #include<vector> using namespace std; /* 3.2.7 vector互换空间 实现两个容器内元素进行互换 swap(vec); // 将vec与本身的元
阅读全文
摘要:#include<iostream> #include<stdlib.h> #include<string> using namespace std; #include<vector> /* 3.2.4 vector容量和大小 empty(); //判断容器是否为空 capacity(); //容器
阅读全文