这个题目你没有到达要求。。“一行字符。”
main()
{
char c[100];
printf("Please input a string less than 100 words:");
scanf("%s",c);
int i, alphabet=0, number=0, space=0, others=0;
for ( i=0; i<100; i++ )
{
if (c[i]==32)
space++;
else if (c[i]>=48 && c[i]<=57)
number++;
else if(c[i]>=65 && c[i]<=90
||
c[i]>=97 && c[i]<=122)
alphabet++;
else if (c[i]==10)/*判断是否是ENTER键*/
break;
else others++;
}
printf("The string has %d alphabets, %d numbers, %
d aces and %d other character.\n", alphabet,number,space,others);
}