Use C language to solve the problem "Input a line of characters, count the number of English letters, spaces, numbers and other characters" and show the code...

Can be solved with the following code: #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' &&

Guess you like

Origin blog.csdn.net/weixin_35756690/article/details/129504638