fork(1) download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. void print(const std::vector<int>& v)
  6. {
  7. for (auto e : v) {
  8. std::cout << e << " ";
  9. }
  10. std::cout << std::endl;
  11. }
  12.  
  13. int main()
  14. {
  15. std::vector<int> v {0, 1, 1};
  16.  
  17. do {
  18. print(v);
  19. } while (std::next_permutation(std::begin(v), std::end(v)));
  20. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
0 1 1 
1 0 1 
1 1 0