#include <iostream>
using namespace std;
int result[8]={0,1,2,3,4,5,6,7};
void exch(int *result,int l,int r)
{
int tmp=result[l];
result[l]=result[r];
result[r]=tmp;
}
void quan(int *result,int left,int right)
{
if(left<=right){
if(left==right){
cout<<result[left];
return;
}
else{
cout<<result[left];
quan(result,left+1,right);
}
}
}
int main()
{
for(int i=0;i<8;++i){
quan(result,0,7);
exch(result,0,i);
cout<<endl;
}
system("pause");
}
错误-全排列
最新推荐文章于 2018-11-11 17:15:37 发布