auto(new)

#include<iostream>
#include<string>
using namespace std;

int main()
{
	int i = 0;
	string s = "hello tomorrow!!!";
	for (auto& c:s)
	{
		if(ispunct(c))
			++i;
		cout << c;
		c = toupper(c);
	}
	cout << endl;
	cout << "字符串:" << s << "标点的个数是:" << i << endl;
}

hello tomorrow!!!
字符串:HELLO TOMORROW!!!标点的个数是:3

你可能感兴趣的:(auto)