C++_STL范例大全

C++_STL范例大全

ID:46956000

大小:352.50 KB

页数:140页

时间:2019-12-01

C++_STL范例大全_第1页
C++_STL范例大全_第2页
C++_STL范例大全_第3页
C++_STL范例大全_第4页
C++_STL范例大全_第5页
资源描述:

《C++_STL范例大全》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、.....SampleofSTLSTL范例(一)容器部分Vector-------------------------------------------1Deque--------------------------------------------------20List---------------------------------------------------38Set-----------------------------------------------------66M

2、ultiset------------------------------------------------88Map-----------------------------------------------------98Multimap-----------------------------------------------113Stack---------------------------------------------------136Queue--------------

3、-------------------------------------138Priority_queue------------------------------------------139学习参考.....Vectorconstructors#include#include#include#includeusingnamespacestd;intmain(){stringstr[]={"Alex","John","

4、Robert"};//emptyvectorobjectvectorv1;//createsvectorwith10emptyelementsvectorv2(10);//createsvectorwith10elements,//andassignvalue0foreachvectorv3(10,0);//createsvectorandassigns//valuesfromstringarrayvectorv4(str+0,str+3);vecto

5、r::iteratorsIt=v4.begin();while(sIt!=v4.end())cout<<*sIt++<<"";cout<v5(v4);for(inti=0;i<3;i++)cout<#include

6、or>#include#includeusingnamespacestd;学习参考.....intmain(){intary[]={1,2,3,4,5};vectorv;//assigntothe"v"thecontainsof"ary"v.assign(ary,ary+5);copy(v.begin(),v.end(),ostream_iterator(cout,""));cout<

7、of100v.assign(3,100);copy(v.begin(),v.end(),ostream_iterator(cout,""));cout<#includeusingnamespacestd;intmain(){vectorv(3,0);v[0]=100;v.at(1)=200;for(inti=0;i<3;i++)cout<

8、<<"";cout<#include学习参考.....#include#includeusingnamespacestd;templateclassMember{public:Member(Tt,Dd):name(t),sal(d){}voidprint();private:Tname;Dsal;

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。