#include <stdio.h>
#include <string.h>
int main()
{
char str[100];
int i,num=0,space=0,capital=0,lowercase=0,other=0;
/*num数字,space空格,capital大写字母,lowercase小写字母
,other其他字符*/
printf("请输入字符串");
gets(str);
// for(i=0;i<strlen(str);i++)//strlen用于计算字符串长度
for(i=0;str[i]!='\0';i++)
{
if(str[i]>='0'&&str[i]<='9') num++;
else if(str[i]==' ') space++;
else if(str[i]>='A'&&str[i]<='Z') capital++;
else if(str[i]>='a'&&str[i]<='z') lowercase++;
else other++;
}
printf("数字数量为:%d\n大写字母数量为:%d\n小写字母数量为:%d\n空格数量为%d\n其他字符数量为:%d\n",num,capital,lowercase,space,other);
return 0;
}