#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
char c;
int yingwen = 0, kongge = 0, shuzi = 0, others = 0;
printf("请输入一些字符: \n");
while ((c = getchar()) != '\n') { //c=getchar()!='\n' -----只要不回车就一直循环。
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
yingwen++;
else if (c == ' ')
kongge++;
else if (c >= '0' && c <= '9')
shuzi++;
else
others++;
}
printf("英文: %d 空格: %d 数字: %d 其他: %d\n", yingwen, kongge, shuzi, others);
return 0;
}