回覆列表
  • 1 # 二師兄programmer

    #include <stdio.h>

    #include <stdlib.h>

    void Permutation(char*a, char*current);

    int main()

    {

    char s[30] = "abcd";

    Permutation(s, s);

    system("pause");

    return 0;

    }

    void Permutation(char*a, char*current)

    {

    if (*current == "\0")

    printf("%s\n", a);

    for (char*next = current; *next != "\0"; next++)

    {

    char tem = *current;

    *current = *next;

    *next = tem;

    Permutation(a, current + 1);

    tem = *current;

    *current = *next;

    *next = tem;

    }

    }

    執行結果:

  • 中秋節和大豐收的關聯?
  • 為什麼一些90後不願意生二胎?二胎意味著什麼?