Skip to content

Instantly share code, notes, and snippets.

@avsej
Created December 9, 2013 14:57
Show Gist options
  • Save avsej/7873490 to your computer and use it in GitHub Desktop.
Save avsej/7873490 to your computer and use it in GitHub Desktop.
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#include <iostream>
#include <algorithm>
using namespace std;
int main () {
int ary[] = {1, 2, 3};
sort(ary, ary + 3);
do {
cout << ary[0] << ' ' << ary[1] << ' ' << ary[2] << endl;
} while (next_permutation(ary, ary + 3));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment