string链接:http://www.cnblogs.com/xFreedom/archive/2011/05/16/2048037.html
vector链接:http://www.cnblogs.com/wang7/archive/2012/04/27/2474138.html
在c++中,vector是一个十分有用的容器,下面对这个容器做一下总结。
1 基本操作
(1)头文件#include.
(2)创建vector对象,vector vec;
(3)尾部插入数字:vec.push_back(a);
(4)使用下标访问元素,cout<
include
include
include
include
using namespace std;
typedef struct rect
{
int id;
int length;
int width;
//对于向量元素是结构体的,可在结构体内部定义比较函数,下面按照id,length,width升序排序。
bool operator< (const rect &a) const
{
if(id!=a.id)
return id