您的位置:首页 > 其它

7.2.2(next_permutation--STL)

2013-02-06 20:51 260 查看
库函数用起来是方便很多,

但就是我没有MSDN呀,,所以木发看源代码..

不管了...这明显要迅速,要简单呀..呵呵

贴出代码哈,呼呼:

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

using namespace std;

char str[1111];

int main()
{
while (scanf("%s", str) != EOF)
{
cout << endl;
int n = strlen(str);
sort(str, str + n); // 用全排列的方法就是先排序,,晕死了都.
puts(str);
while (next_permutation(str, str + n)) // 反正方便,嘿嘿...
{
puts(str);
}
}
system("pause");
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: