字符串的全排列和组合算法
void Permutation(char* pStr, char* pBegin) { assert(pStr && pBegin); if(*pBegin == '\0') printf("%s\n",pStr); else { for(char* pCh = pBegin; *pCh != '\0'; pCh++) { swap(*pBegin,*pCh); Permutation(pStr, pBegin+1); swap(*pBegin,*pCh); } } } int main() { char str[] = "abc"; Permutation(str,str); getchar(); return 0; }