|
| ashmew2 (7) | |
| 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 | |
| jsmith (3099) | |
| Google next_permutation. | |
| ashmew2 (7) | |
| Thanks jsmith , it looks promising! | |
| HaHai (1) | |
| #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; } | |
| ashmew2 (7) | |
| Thankyou HaHai. | |
This topic is archived - New replies not allowed.
