fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main () {
  7. int myints[] = { 10, 20, 30 ,40 };
  8.  
  9. vector<int> myvector (myints,myints+2);
  10. vector<int>::iterator it;
  11.  
  12. // iterator to vector element:
  13. it = find (myvector.begin(), myvector.end(), 40);
  14. cout << *it << endl;
  15.  
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0.01s 2812KB
stdin
Standard input is empty
stdout
0