学习迭代器
#include <iostream>
#include <vector>
using namespace std;
vector<int>::iterator find(vector<int>& source, int num)
{
vector<int>::iterator begen = source.begin();
vector<int>::iterator end = source.end();
while (begen != end)
{
if (*begen == num)
return begen;
begen++;
}
}
int main()
{
vector<int> a;
int i;
for(i = 0; i <= 10; i++)
a.push_back(i);
vector<int> c(a.begin(), a.end());
vector<int>::iterator result = find(a, 4);
cout<<*result<<endl;
cout<<*(a.begin())<<endl;
system("pause");
return 0;
}