
int main()
{
string str;
cout << "请输入字符串:";
getline(cin, str);
int big_num = 0;
int smoll_num = 0;
int blank_num = 0;
int number_num = 0;
int other = 0;
for(int i=0;i<str.size();i++)
{
if(str.at(i)>='a' && str.at(i)<='z')
{
smoll_num++;
}
else if(str.at(i)>='1' && str.at(i)<='9')
{
number_num++;
}
else if(str.at(i)>='A' && str.at(i)<='Z')
{
big_num++;
}
else if(str.at(i) == ' ')
{
blank_num++;
}
else
{
other++;
}
}
cout << "字符大写数量:" << big_num << endl;
cout << "字符小写数量:" << smoll_num << endl;
cout << "数字数量:" << number_num << endl;
cout << "空格数量:" << blank_num << endl;
cout << "其它字符数量:" << other << endl;
return 0;
}
