上代码
#include<stdio.h>
int main()
{
char str[3][81];
int i,j;
for(j=0;j<3;j++)
gets(str[j]);
int a=0, b=0, c=0, d=0, e=0;
for(j=0;j<3;j++)
{
for(i=0;i<81&&(str[j][i]!='\0');i++)
{
if(str[j][i]== ' ')
{
d++;
}
else if(str[j][i] >= 'a' && str[j][i] <= 'z')
{
b++;
}
else if(str[j][i] >= 'A' && str[j][i] <= 'Z')
{
a++;
}
else if (str[j][i] >= '0' && str[j][i] <= '9')
{
c++;
}
else
{
e = ++e;
}
}
}
printf("大写字母为%d个\n小写字母为%d个\n数字为%d个\n空格字符为%d个\n其他字符为%d个\n",a,b,c,d,e);
return 0;
}
结果: