思维导图
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/34881054d6f145ebbc0d091cb732b21f.png#pic_center)
作业
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main()
{
string str;
cout << "please enter string:" << endl;
getline(cin,str);
int capital_num=0;
int lower_num=0;
int digit_num=0;
int bspace_num=0;
int other_num=0;
for(int i=0;i<str.length();i++)
{
if(str[i]>='A' && str[i]<='Z' )
{
capital_num++;
}
else if(str[i]>='a' && str[i]<='z')
{
lower_num++;
}
else if(str[i]>='0' && str[i]<='9')
{
digit_num++;
}
else if(isspace(str[i]))
{
bspace_num++;
}
else
{
other_num++;
}
}
cout << "大写字母个数:" << capital_num <<endl;
cout << "小写字母个数:" << lower_num <<endl;
cout << "数字个数:" << digit_num <<endl;
cout << "空格个数:" << bspace_num <<endl;
cout << "其他字符格式个数:" << other_num <<endl;
return 0;
}