2013年8月6日
摘要: 一、容器的分类容器有序列式容器(Sequence containers)和关联式容器(Associated containers)序列式容器:每个元素的位置取决于元素被插入的时机,被插入时设置的位置,和元素值本身无关。序列式容器有vector、deque、list关联式容器:元素位置取决于特定的排序准则,和插入顺序无关。关联式容器有set、multiset、map、multimap二、vector1.vector简介vector是将元素置于一个动态数组中加以管理的容器。vector可以随机存取元素(支持索引值直接存取, 用[]操作符或at()方法)。vector尾部添加或移除元素非常快速。但是 阅读全文
posted @ 2013-08-06 23:10 奎哥 阅读(450) 评论(0) 推荐(0) 编辑
摘要: 1.string使用之前的准备?12#include using namespace std;2.string的构造函数 1 #include 2 using namespace std; 3 4 void main() 5 { 6 string s1; string s2; //默认构造函数: 7 8 string s1(s2); //拷贝构造函数 9 10 string strA("UIPower"); //带参数的构造函数:11 string strB(5,'A'); //"AAAAA"12 ... 阅读全文
posted @ 2013-08-06 22:32 奎哥 阅读(230) 评论(0) 推荐(0) 编辑