见代码
1 #define _CRT_SECURE_NO_WARNINGS 1 2 #include<stdio.h> 3 int main() 4 { 5 int i, j, upp, low, dig, spa, oth; 6 char text[3][80]; 7 upp = low = dig = spa = oth = 0; 8 for (i = 0; i < 3; i++) 9 { 10 gets(text[i]);//通过这个可以完成数据输入 11 { 12 for (j = 0; j < 80 && text[i][j] != '\0'; j++)//就很有灵性 13 { 14 if (text[i][j] >= 'A' && text[i][j] <= 'Z') upp++; 15 else if (text[i][j] >= 'a' && text[i][j] <= 'z') low++; 16 else if (text[i][j] >= '0' && text[i][j] <= '9') dig++; 17 else if (text[i][j] = ' ') spa++; 18 else oth++; 19 } 20 } 21 } 22 printf("upper case:%d\n", upp); 23 printf("lower case:%d\n", low); 24 printf("digit:%d\n", dig); 25 printf("space:%d\n", spa); 26 printf("other:%d\n", oth); 27 return 0; 28 }
标签:字符,小写字母,text,int,&&,80 From: https://www.cnblogs.com/yxyfj/p/16988406.html