Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iterator>
- #include <set>
- using namespace std;
- int main()
- {
- int i;
- set<int>::iterator it;
- set<int> mySet;
- set<int> set2;
- set<int> set3;
- set<int> set6;
- set<int> set9;
- for (i = 15; i < 100; i++)
- mySet.insert(i);
- for (it = mySet.begin(); it != mySet.end(); it++)
- {
- if (*it % 2 == 0)
- set2.insert(*it);
- if (*it % 3 == 0)
- set3.insert(*it);
- if (*it % 6 == 0)
- set6.insert(*it);
- if (*it % 9 == 0)
- set9.insert(*it);
- }
- for (it = set2.begin(); it != set2.end(); it++)
- cout << *it << " ";
- cout << endl;
- for (it = set3.begin(); it != set3.end(); it++)
- cout << *it << " ";
- cout << endl;
- for (it = set6.begin(); it != set6.end(); it++)
- cout << *it << " ";
- cout << endl;
- for (it = set9.begin(); it != set9.end(); it++)
- cout << *it << " ";
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement