nest_permutation n个元素n!种不同排列测试程序代码

 #include <iostream>
 #include <algorithm>
 using namespace std;
 int main(){
     int a[3]={1, 2, 3};
     do{
        for (int i = 0; i < 3; i++)
            cout<<a[i];
        cout<<endl;
     }while(next_permutation(a, a + 3));
     return 0;
 }

测试结果:

*******************

 

posted @ 2015-01-26 13:12  do+better  阅读(110)  评论(0编辑  收藏  举报