#include <stdio.h>
#include <conio.h>
int main(){
printf("请输入一行字符:");
char num;
int num_yingwen=0,num_space=0,num_shuzi=0,num_other=0;
while((num=getchar())!='\n'){
if(num >= 'a'&&num <= 'z' || num >= 'A'&&num <= 'Z')
num_yingwen++;
else if(num==' ')
num_space++;
else if(num>='0'&&num<='9')
num_shuzi++;
else
num_other++;
}
printf("英文个数为%d,空格字数为%d,数字字数为%d,其他字符个数为%d",num_yingwen,num_space,num_shuzi,num_other);
getchar();
return 0;
}
#include <conio.h>
int main(){
printf("请输入一行字符:");
char num;
int num_yingwen=0,num_space=0,num_shuzi=0,num_other=0;
while((num=getchar())!='\n'){
if(num >= 'a'&&num <= 'z' || num >= 'A'&&num <= 'Z')
num_yingwen++;
else if(num==' ')
num_space++;
else if(num>='0'&&num<='9')
num_shuzi++;
else
num_other++;
}
printf("英文个数为%d,空格字数为%d,数字字数为%d,其他字符个数为%d",num_yingwen,num_space,num_shuzi,num_other);
getchar();
return 0;
}