set
来源:互联网 发布:办公软件培训多少钱 编辑:程序博客网 时间:2024/06/05 05:10
参照算法笔记 P197
#include<stdio.h>#include<set>//从小到大 且 不重复 using namespace std;//set<typename> nameint main(){set<int> st;st.insert(3);//insert()插入元素 st.insert(2);st.insert(5);st.insert(3);set<int>::iterator it=st.begin(); for(;it!=st.end();it++){// 只能通过迭代器访问 printf("%d\n",*it);}it=st.find(5);//find() 返回迭代器 printf("%d\n",*it);st.erase(it); // eraser()删除迭代器对应的值 st.erase(2);//或者 直接 删除 值 printf("%d\n",st.size());// 返回元素个数 st.clear();//清空所有元素 }
阅读全文
0 0
- set /?
- Set
- set
- set
- set
- Set
- set
- Set
- Set
- set
- set
- Set
- set
- Set
- set
- Set
- set
- Set
- 详解java定时任务
- hdu 6090 Rikka with Graph [想法题]
- 试题信息管理系统java
- 大流量高并发网站解决问题
- Mongo DB索引的使用
- set
- Python目标
- Map和I/O流
- 大数据学习笔记:修改windows下的hosts文件便于hadoop的web访问
- arm-linux-gnueabihf-gcc: error while loading shared libraries: libstdc++.so.6: cannot open shared ob
- C/C++获取系统时间戳,精确到毫秒
- 如何使用JDBC
- MOOC清华《程序设计基础》第9章:自动售卖程序 v 3.1
- StringUtils中isNotEmpty与isNotBlank