使用C语言解决问题“输入一行字符,分别统计出其中英文字母、空格、数字和其他字符的个数”并展示代码...

可以使用以下代码解决: #include <stdio.h> #include <string.h> int main() { char str[100]; int i; int letters = 0; int space = 0; int digits = 0; int others = 0;

printf("输入一行字符:"); 
gets(str); 

for (i = 0; str[i] != '\0'; i++) { 
    if ((str[i] >= 'a' &&

猜你喜欢

转载自blog.csdn.net/weixin_35756690/article/details/129504638