#include<cstdlib>
#include<algorithm>
#include<vector>
#include<iterator>
#include<iomanip>
using namespace std;
int main()
{
vector<char> v(4);
char a[35]={'1','2','3','4','5','6','7','8','9','a','b','c','d',
'e','f','g','h','i','j','k','l','m','n','o','p',
'q','r','s','t','u','v','w','s','y','z'};
for(int k=0;k<=31;k++)
{
for(int m=k+3;m<=34;m++)//在数组a中选四个数
{
v[0]=a[k];
v[1]=a[k+1];
v[2]=a[k+2];
v[3]=a[m];
copy(v.begin(), v.end() , ostream_iterator<char>(cout,"")); //对这四个数进行全排列
cout<<setw(5);
while( next_permutation( v.begin(), v.end() ) )
{
copy(v.begin(), v.end() , ostream_iterator<char>(cout,""));
cout<<setw(5);
}
}
}
system("pause");
}
跟这个程序差不多吧!