STL
雨中山草
这个作者很懒,什么都没留下…
展开
-
STL::vector
在vector中查找元素及其位置#include "stdafx.h"#include <iostream>#include <vector>#include <algorithm>using namespace std;int main(){ // A dynamic array of integers vector <int> vecIntegerArray;原创 2016-06-23 23:23:47 · 229 阅读 · 0 评论 -
STL::string类
本文摘自《21天学通C++》 最常用的字符串函数包括:复制连接查找字符和字符串截断使用标准模版库提供的算法实现字符串反转和大小写转换 使用STL string类,需包含头文件 1、实例化STL string及复制#include "stdafx.h"#include <string>#include <iostream>using namespace std;int main原创 2016-06-26 22:26:09 · 425 阅读 · 0 评论 -
STL动态数组类
1、std::vector的特点 是一个模板类,提供了动态数组的通用功能,使用时要包含头文件#include <vector>在数组末尾添加元素所需的时间是固定的,即在末尾插入元素的所需时间不随数组大小而异,在末尾删除元素也如此;在数组中间添加或删除元素所需的时间与该元素后面的元素个数成正比;存储的元素数是动态的,而vector类负责管理内存。 2、典型的vector操作 (1)实例化v原创 2016-06-27 23:45:57 · 829 阅读 · 0 评论