📄 count.c
字号:
/*count.c: 统计各个数字、空白及其它字符的次数*/int puts(char *);int printf(char *fmt, int);int getchar();int main(void){ int c, i, nwhite, nother; int ndigit[10]; nwhite = nother = 0; i = 0; while (i < 10) { ndigit[i] = 0; i = i + 1; } while ((c = getchar()) != -1) { if (c >= '0') if (c <= '9') { ndigit[c-'0'] = ndigit[c-'0'] + 1; continue; } if (c == ' ') nwhite = nwhite + 1; else if (c == '\n') nwhite = nwhite + 1; else if (c == '\t') nwhite = nwhite + 1; else nother = nother + 1; } puts("digits ="); i = 0; while (i < 10) { printf(" %d", ndigit[i]); i = i + 1; } printf(",white space = %d", nwhite); printf(",other = %d\n",nother);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -