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");
}
#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");
}
相关文章推荐
- C++文本查询程序 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 不要定义类和智能指针管理数据 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 不要定义类和智能指针管理数据 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 不要定义类和智能指针管理数据 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 不要定义类和智能指针管理数据 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 不要定义类和智能指针管理数据 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 不要定义类和智能指针管理数据 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 不要定义类和智能指针管理数据 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 不要定义类和智能指针管理数据 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 不要定义类和智能指针管理数据 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果
- C++文本查询程序 不要定义类和智能指针管理数据 C++Primer练习12.28 使用vector,map,set容器保存来自文件的数据并生成查询结果