統計用戶輸入的數字、空白符及其餘字符出現個數

int c, i, nwhite=0, nother=0; int ndigit[10]; for (i = 0; i < 10; ++i) ndigit[i] = 0; while ((c = getchar()) != '\n') { if (c >= '0' && c <= '9') ++ndigit[c - '0'];//採用int型變量的相減關係獲得對應數組索引
相關文章
相關標籤/搜索