#include <stdio.h> #include <conio.h>int main(int argc, char * argv[]) {char ch;int letters = 0, space = 0, digit = 0, others = 0;printf("请输入一组字符串:\n");while((ch=getchar())!='\n'){if(ch>'a' && ch < 'z' || ch >'A' && ch< 'Z')letters++;else if(ch == ' ')space++;else if(ch>='0' && ch<='9')digit++;elseothers++;}printf("英文个数为:%d,空格为:%d,数字为:%d,其他字符:%d", letters, space, digit, others);getch();return 0; }
转载于:https://www.cnblogs.com/pythonschool/archive/2012/10/29/2745562.html