Advertisement
mercMatvey4

Untitled

Apr 29th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #include <iostream>
  2. #include <iterator>
  3. #include <set>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int i;
  10. set<int>::iterator it;
  11. set<int> mySet;
  12. set<int> set2;
  13. set<int> set3;
  14. set<int> set6;
  15. set<int> set9;
  16. for (i = 15; i < 100; i++)
  17. mySet.insert(i);
  18. for (it = mySet.begin(); it != mySet.end(); it++)
  19. {
  20. if (*it % 2 == 0)
  21. set2.insert(*it);
  22. if (*it % 3 == 0)
  23. set3.insert(*it);
  24. if (*it % 6 == 0)
  25. set6.insert(*it);
  26. if (*it % 9 == 0)
  27. set9.insert(*it);
  28. }
  29. for (it = set2.begin(); it != set2.end(); it++)
  30. cout << *it << " ";
  31. cout << endl;
  32. for (it = set3.begin(); it != set3.end(); it++)
  33. cout << *it << " ";
  34. cout << endl;
  35. for (it = set6.begin(); it != set6.end(); it++)
  36. cout << *it << " ";
  37. cout << endl;
  38. for (it = set9.begin(); it != set9.end(); it++)
  39. cout << *it << " ";
  40. cout << endl;
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement