Guest User

Untitled

a guest
Jan 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <set>
  5. using namespace std;
  6.  
  7.  
  8. int main() {
  9.  
  10. set<int> s;
  11. for (int i = 0; i < 10; i++) {
  12. s.insert(i);
  13. }
  14.  
  15. for (auto it = s.begin(); it != s.end();it++) {
  16.  
  17. if ((*it) % 2 == 0)
  18. s.erase(it);
  19. }
  20.  
  21.  
  22.  
  23. for (auto it = s.begin(); it != s.end();) {
  24.  
  25. if ((*it) % 2 == 0)
  26. it = s.erase(it);
  27. else
  28. it++;
  29.  
  30. }
  31.  
  32. }
Add Comment
Please, Sign In to add comment