现成函数的全排列

#include <iostream>
#include <algorithm> /// next_permutation, sort里卖弄包括两个函数,桉顺序获得下一个要排列的数,也可以自己写一个泪时的函数。。
using namespace std;
int main () {
char myints[1005];
int n,i;while(cin>>myints)
{n=strlen(myints);
sort (myints,myints+n);

do {
for(i=0;i<n;i++)
cout<<myints[i];cout<<endl;
} while ( next_permutation(myints,myints+n) ); ///获取下一个较大字典序排列
}
return 0;
}

posted @ 2016-04-30 18:31  地对地导弹2  Views(107)  Comments(0)    收藏  举报