标签:
#include <iostream>
using namespace std;
void Swap(char &s1,char &s2)
{
char temp=s1;
s1=s2;
s2=temp;
}
void Perm(char s[],int k,int m)
{
if(k==m)
cout<<s<<endl;
else
{
for(int i=k;i<=m;i++)
{
Swap(s[k],s[i]);
Perm(s,k+1,m);
Swap(s[k],s[i]);
}
}
}
int main()
{
char s[]="abcd";
Perm(s,0,strlen(s)-1);
return 0;
}
标签:
原文地址:http://blog.csdn.net/sxhlovehmm/article/details/45175271