C++STL-list和set
来源:互联网 发布:oppo商城软件下载 编辑:程序博客网 时间:2024/05/18 04:55
C++STL-list和set
list
#include<cstdio>#include<iostream>#include<list>using namespace std;int main() { list<int> a1; list<int>::iterator it; for (int i = 1; i <= 5; i++) { a1.push_back(i); } for (it = a1.begin(); it != a1.end(); it++) { printf("%d ", *it); } return 0;}
set
#include<cstdio>#include<iostream>#include<set>using namespace std;int main() { for (int i = 1; i < 5; i++) { for (int j = 1; j < 5; j++) { set<int> s; set<int>::iterator pos; s.insert(i); s.insert(j); for (pos = s.begin(); pos != s.end(); pos++) { int k = *pos; printf("%d",k); } puts(""); } } return 0;}
可以看到 set内部有去重的作用
记录一下 以后可以看看
0 0
- C++STL-list和set
- C/C++--STL中list,vector,deque,map,set区别、联系和使用场景
- C/C++--STL中list,vector,deque,map,set区别、联系和使用场景
- C++STL(vector,map,set,list)成员函数整理
- C++STL之set
- C++--STL---set容器
- C++STL--map和set词频统计和单词转换
- STL---set和multiset
- STL set和multiset
- STL set和multiset
- STL - set和multiset
- STL: set 和 priority_queue
- 【温故而知新】C和C++9:STL中的set容器
- C++STL中的set容器和map容器
- CF 527C STL set和multiset 典型应用
- C++STL学习(4)容器set和multiset
- [c++] stl list
- 【C++】STL--LIST
- 将DHT11移植到Linux系统上续
- iOS中使用NSURLSession上传字符串
- js实现简单的时钟
- ZOJ 3279 Ants(线段树单点更新和查询)
- android开发步步为营之95:自定义dialog去掉白色边框
- C++STL-list和set
- js实现svg绘图的时针
- 析构函数不为虚函数时的处理方式
- 操作系统课程设计2 编写Linux bash脚本
- C/CPP点滴积累—程序内存
- 使用CALayer的Mask实现注水动画效果
- 神秘数
- 1001. 害死人不偿命的(3n+1)猜想
- unity3d事件函数整理,事件,回调函数,消息处理