next_permutation 函数

 

next_permutation 是一个定义在 <algorithm> 中的一个全排列函数, 用于按顺序生成一个数列的全排列

基本用法 :

int a[] = {1, 2, 3};
    
do{
    cout << a[0] << a[1] << a[2] << endl;
}while(next_permutation(a, a+3));

 

posted @ 2018-07-30 15:25  楼主好菜啊  阅读(160)  评论(0)    收藏  举报