Advertisement
apl-mhd

Pair Inside Vector Iterator

Apr 30th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <map>
  5. #include <algorithm>
  6. #include <climits>
  7. #include <utility>      // std::pair
  8.  
  9.  
  10. using namespace std;
  11.  
  12. int main() {
  13.  
  14.     vector<pair<int,int>>a;
  15.  
  16.     vector<pair<int, int>>::iterator it;
  17.  
  18.  
  19.  
  20.  
  21.  
  22.     a.push_back(make_pair(10,20));
  23.  
  24.     cout<<a[0].first;
  25.  
  26.  
  27.  
  28.     for( it = a.begin(); it != a.end(); it++){
  29.  
  30.         cout<<(*it).first;
  31.  
  32.     }
  33.  
  34.  
  35.  
  36.  
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement