#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;
}

相关文章:

  • 2022-01-20
  • 2021-06-30
  • 2021-12-15
  • 2021-10-04
  • 2021-11-16
  • 2022-01-29
  • 2021-06-20
  • 2021-08-08
猜你喜欢
  • 2022-12-23
  • 2022-02-28
  • 2021-07-14
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
相关资源
相似解决方案