#include <iostream>
#include <algorithm>
using namespace std;
int main(int argc, char* argv[])
{
int a[5] = {1, 2, 3,4,5};
char b[5] = {'A', 'B', 'C','D','E'};
int count = 1;
sort(b, b + 5);
do
{
cout << count << "
" << a[0] << "->" << b[0] << " ";
cout << "
" << a[1] << "->" << b[1] << " ";
cout << "
" << a[2] << "->" << b[2] << "
";
cout << "
" << a[3] << "->" << b[3] << "
";
cout << "
" << a[4] << "->" << b[4] << endl;
count++;
}
while(next_permutation(b, b + 5));//注意这个函数的用法:
return 0;