Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- int main(int c, const char **v)
- {
- basic_string<const char *> options(v);
- auto N(options.length());
- for (auto n = 1u; n < N; ++n) {
- vector<char> pick(N);
- fill_n(pick.rbegin(), n, 1);
- do for (auto j=1u; j<N; ++j)
- if (pick[j])
- cout << options[j]<<' ';
- while (cout<<'\n', next_permutation(begin(pick)+1, end(pick)));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement