fork download
  1. #include <algorithm>
  2. #include <iostream>
  3.  
  4. void print_combination(const std::vector<int*>& v)
  5. {
  6. std::vector<std::size_t> indexes(v.size());
  7. std::iota(indexes.begin(), indexes.end(), 0u);
  8.  
  9. do {
  10. for (auto index : indexes) {
  11. std::cout << ' ' << *v[index];
  12. }
  13. std::cout << std::endl;
  14.  
  15. } while (std::next_permutation(indexes.begin(), indexes.end()));
  16. }
  17.  
  18. int main() {
  19. int integers[] = {0, 0, 0};
  20.  
  21. print_combination({&integers[0], &integers[1], &integers[2]});
  22. }
  23.  
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
 0 0 0
 0 0 0
 0 0 0
 0 0 0
 0 0 0
 0 0 0