NEXT PERMUTATION

In the way of programming there is some problems on thye basis of finding the permutation. Today I am giving a sample to create all permutations of an string.


// next_permutation
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>

using namespace std;

int main () {

int n,i,l;
char myints[1000];

gets(myints);
l=strlen(myints);
sort (myints,myints+l);

do {
cout << myints<< endl;
} while ( next_permutation (myints,myints+l) );

return 0;
}

One Reply to “NEXT PERMUTATION”

Leave a Reply

Your email address will not be published. Required fields are marked *