Advertisement
ibragimova_mariam

MAPSETWTF

Nov 16th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <iostream>
  2. #include <set>
  3. #include <map>
  4.  
  5. #define para pair <int,int>
  6.  
  7. using namespace std;
  8.  
  9. int main ()
  10. {
  11. map<para, set<para>> mymap;
  12.  
  13. for (int i = 1; i < 2; i ++) {
  14. set <para> myset;
  15. myset.insert(make_pair(i, i));
  16. mymap[make_pair(0, 0)] = myset;
  17. }
  18.  
  19. if(mymap.find(make_pair(0, 0)) != mymap.end()) {
  20. if(mymap[make_pair(0, 0)].find(make_pair(2, 2)) != mymap[make_pair(0, 0)].end()) cout << "is in set" << endl;
  21. else {
  22. cout << "not int set";
  23. mymap[make_pair(0, 0)].insert(make_pair(2, 2));
  24. if(mymap[make_pair(0, 0)].find(make_pair(2, 2)) != mymap[make_pair(0, 0)].end()) cout << "NOW is in set";
  25. }
  26. }
  27. else cout << "not in map";
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement