1. 提示并输入一个字符串,统计该字符串中大写小写字母个数,数字个数,空格个数以及其他字符个数,要求使用c++风格字符串完成
#include <iostream>
#include <string>
using namespace std;
int main()
{
	cout << "请输入字符串:" << endl;
	string str;
	getline(cin, str);
	int low = 0, up = 0, num = 0, other = 0, space = 0;
	for (int i = 0; i < str.size(); i++)
	{
		if (islower(str[i]))
		{
			low++;
		}
		else if (isupper(str[i]))
		{
			up++;
		}
		else if (str[i] >= '0' && str[i] <= '9')
		{
			num++;
		}
		else if (str[i] == ' ')
		{
			space++;
		}
		else
		{
			other++;
		}
	}
	cout << "low = " << low << ", up = " << up << ", num = " << num << ", space =" << space << ", other = " << other << endl;
	return 0;
}




















