int main()
{
int alph = 0, num = 0, space = 0, other = 0;
char c;
while ((c=getchar()) != '\n')
{
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
alph ++;
else if (c >= '0' && c <= '9')
num ++;
else if (c == ' ')
space ++;
else
other ++;
}
printf("1001 static:\n");
printf("There are %d Alphabet Characters.\n", alph);
printf("There are %d Number Characters.\n", num);
printf("There are %d Space Characters.\n", space);
printf("There are %d Other Characters.\n", other);
return 0;
}
有问题再联系~