STL实现全排列
//全排列
#include<iostream>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<map>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
void main()
{
vector<int>a;
int i;
for(i=1;i<=3;i++)
{
a.push_back(rand()%100);
}
sort(a.begin(),a.end());//调用全排列函数时要求是一个升序排列的头指针和尾指针 N!个
do
{
for(i=0;i<a.size();i++)
cout<<a[i]<<" ";
cout<<endl;
}while(next_permutation(a.begin(),a.end()));
}