next_permutation

实验了一下next_permutation

代码如下

 1 #include <cstdio>
 2 #include <cstdlib>
 3 #include <cstring>
 4 #include <iostream>
 5 #include <algorithm>
 6 using namespace std;
 7 
 8 int main(int argc, char const *argv[])
 9 {
10     char s[] = "123";
11     int len = strlen(s);
12     do {
13         puts(s);
14     }
15     while(next_permutation(s,s+len));
16     
17     getchar();
18     return 0;
19 }

效果如下

 

posted @ 2016-08-19 16:21  Jason杰  阅读(168)  评论(0编辑  收藏  举报