int a[];
do
{
}while( next_permutation(a , a + n);
#include <bits/stdc++.h>
using namespace std;
int n;
int main()
{
int a[4] ={1,3,2};
sort( a ,a + 3);
do
{
for(int i = 0;i<3 ;i++)
cout<<a[i]<<" ";
puts("");
}while(next_permutation(a , a + 3));
return 0;
}
运行结果如下: