Generate Permutations.

Hi , I want to Generate Permutations of 5 digit with numbers 1 to 6. How Can i go about it ? Im using G++ under Ubuntu Intrepid Ibex. Permutation is Basically Arrangement. like Using 1 , 2 and 3 , The possible permutations are :

123
132
213
231
312
321

Thanks.
Last edited on
Google next_permutation.

Thanks jsmith , it looks promising!
#include <iostream>

using namespace std;

int main(){
int nb[] = {1,2,3};
for(int a=0; a<3; a++)
for(int b=0; b<3; b++)
for(int c=0; c<3; c++)
if(a!=b && a!=c && b!=c)
cout << nb[a] << nb[b] << nb[c] << endl;
return 0;

}
Thankyou HaHai.
Topic archived. No new replies allowed.