方法1:
#include <stdio.h>#include <stdlib.h>
void Permutation(char a[], int start, int end)
{
int i,j;
char temp;
if(start == end)
{
for(i = 0; i <= end; i++)
printf(" %c ",a[i]);
printf("n");
}
else
{
for(i = start; i <= end; i++)
{
for(j=start;j<i;j++)
if(a[j]==a[i]) goto nextI;
temp=a[start]; a[start]=a[i]; a[i]=temp;
Permutation(a, start+1, end);
temp=a[start]; a[start]=a[i]; a[i]=temp;
nextI:;
}
}
}
int main()
{
char A[] = "abcc";
Permutation(A,0,3);
system("pause");
return 0;
}
复制代码
复制代码
最后
以上就是强健雨最近收集整理的关于写一个函数,输出字符串中字符的所有排序。(比如:abc acb bac bca cab cba )的全部内容,更多相关写一个函数,输出字符串中字符的所有排序。(比如:abc内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复