8.28日QT
思维导图
#include <iostream>using namespace std;int main()
{int a=0,b=0,c=0,d=0;string i;cout << "请输入一个字符串" << endl;getline(cin,i);int y=i.size()-1;while(1){if('a'<=i[y]&&i[y]<='z'){a=a+1;}else if('A'<=i[y]&&i[y]<='Z'){b=b+1;}else if('0'<=i[y]&&i[y]<='9'){c=c+1;}else if(i[y]==' '){d=d+1;}y--;if(y==-1){cout << "小写字母"<< a << "个" << endl;cout << "大写字母"<< b << "个" << endl;cout << "数字"<< c << "个" << endl;cout << "空格"<< d << "个" << endl;return 0;}}return 0;
}