Playground
//koristi C++11 - http://mendo.mk/Lecture.do?id=26 #include <iostream> #include <vector> #include <algorithm> using namespace std; void print(vector<int> &permutation) { for (auto value : permutation) { cout << value << " "; } cout << endl; } int main() { vector<int> permutation = {1, 2, 3, 4, 5}; do { print(permutation); } while(next_permutation(permutation.begin(), permutation.end())); return 0; }
Input data
Program output
Execute
Language: ????????? | Memory: ???? KB | Time: ??? ms
Nothing has been executed, yet!