#include <iostream>
#include <string.h>
using namespace std;
int main()
{
cout << "please enter:";
string name;
getline(cin, name);
int i = 0, x = 0, y = 0, z = 0, q = 0;
for (char ch : name)
{
if (ch >= 'a' && ch <= 'z')
{
x++;
}
if (ch >= 'A' && ch <= 'Z')
{
y++;
}
if (ch >= '0' && ch <= '9')
{
z++;
}
if (ch == ' ')
{
q++;
}
}
cout << "小写 = " << x << endl;
cout << "大写 = " << y << endl;
cout << "数字 = " << z << endl;
cout << "空格 = " << q << endl;
return 0;
}
20240829
最新推荐文章于 2024-08-29 23:35:19 发布