回覆列表
  • 1 # 匠工加工

    #include <stdio.h>int main() {

    int i = 0,j = 0,k = 0;

    char s[100],alab[100],alpha[100],other[100],*p;

    printf("請輸入字串 : ");

    gets(s);

    p = s;

    while(*p) {

    if((*p >= "0") && (*p <= "9")) alab[i++] = *p;

    else if((*p >= "a") && (*p <= "z")) alpha[j++] = *p;

    else if((*p >= "A") && (*p <= "Z")) alpha[j++] = *p;

    else other[k++] = *p;

    ++p;

    }

    alab[i] = "\0";

    alpha[j] = "\0";

    other[k] = "\0";

    printf("阿拉伯數字串 : %s\n",alab);

    printf("英文字串 : %s\n",alpha);

    printf("其他字串 : %s\n",other);

    return 0;

    }

  • 中秋節和大豐收的關聯?
  • 觀潮摘抄好詞語好句?