#include #include #include #include #include using namespace std;int f[4]={0,1,2,3};char ch[4][10]={"a2b8","5a8f","b9ec","5c2f"};int main(){ int i,j,k; for(i=0;i<24;i++)//共4!个排列 { for(j=0;j<4;j++) printf("%s",ch[f[j]]); printf("\n"); next_permutation(f,f+4);//下一个排列 } return 0;}看代码,应该好懂的吧