set 的使用
来源:互联网 发布:企业工商数据api 编辑:程序博客网 时间:2024/05/01 17:24
set可以插入很多值,去掉重复元素,并可以查找
#include<iostream>#include<cstdio>#include<string>#include<set>using namespace std;int main(){ set<string> st; st.clear(); //清空 string nm[]={"abc","david","lucy","abc","app","lucy"}; for(int i=0; i<6; i++) st.insert(nm[i]); //st里插入元素 set<string>::iterator it; //set容器的指针 for(it=st.begin(); it!=st.end(); it++){ cout<<*it<<endl; //按字典序输出 } it=st.find("app"); if(it!=st.end()) cout<<"find"<<" "<<"app"<<endl; else cout<<"can't find"<<" "<<"app"<<endl; //找到了就输出find,找不到就输出can't find it=st.find("bld"); if(it!=st.end()) cout<<"find"<<" "<<"bld"<<endl; else cout<<"can't find"<<" "<<"bld"<<endl; system("pause");}
0 0
- stl set的使用
- set的使用
- set的使用
- Working Set 的使用
- Set的使用
- Set的使用
- Set的使用
- java set的使用
- STL set的使用
- set 的使用例子
- set 的使用
- 容器set的使用
- Set的使用
- set的基本使用
- set的使用
- list,set的使用
- Set容器的使用
- Python set()的使用
- Myabtis的CRUD操作
- Druid数据库连接池及内置监控的配置和使用
- Android布局(1)--线性布局(LinerLayout)
- Hadoop运行任务时一直卡在: INFO mapreduce.Job: Running job
- Message、Handler、MessageQueue、Looper之间的关系
- set 的使用
- ubuntu安装RapidSVN
- Yarn简单介绍及内存配置
- 构造函数返回值的理解
- JavaSwing制作简单计算器
- Hibernate 映射文件更新
- 数据库索引的实现原理
- 微机原理==Pentium(奔腾)的指令系统(4)
- Android Journey: Graphics