您的位置:首页 > 编程语言 > C语言/C++

vector的使用(C++primer)。。。2014.5.5

2014-05-05 11:26 197 查看
#ifndef _3_3_VECTOR_

#define _3_3_VECTOR_
#include<iostream>
#include<vector>
#include<string>
using namespace std;
//using std::vector;
#endif

#include"vector_3_3.h"
void main()
{/*
vector的使用:
将一组整数存入一个vector中,然后依次输出相邻的两个数的和。
采用迭代器的方法。
*/
vector<int>v1;
int a;
while(cin>>a)
v1.push_back(a);
//auto t2=v1.end();
for(auto t1=v1.begin();t1!=v1.end()-1;++t1)
cout<<*t1+*(t1+1)<<endl;
system("pause");
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐