Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void all_subsets(int* uset, int n)
- {
- for (int i = 0; i < (int)pow(2, n); ++i) {
- string s = bitset<5>(i).to_string();
- int is_odd = true;
- for (int j = 0; j < s.size(); ++j) {
- if (j % 2 != 0)
- {
- if (s[j] != '1') is_odd = false;
- }
- }
- if (is_odd)
- {
- for (int j = 0; j < s.size(); ++j) {
- cout << s[j] << "\t";
- }
- cout << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement