next_permutation就是按字典序进行下一次排列
int main()
{
int num[3]={1,2,3};
do
{
cout<<num[0]<<” “<<num[1]<<” “<<num[2]<<endl;
}while(next_permutation(num,num+3));
结果是 1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1