#include<iostream>
#include<string>
using namespace std;
bool any_capital(string const &str)//不需要修改 设为常量引用
{
for (auto ch : str)
if (isupper(ch))
return true;
return false;
}
void to_lowercase(string &str)//需要修改 设为普通引用
{
for (auto &ch : str)
ch = tolower(ch);
}
int main()
{
string hello("Hello World!");
cout << any_capital(hello) << endl;
to_lowercase(hello);
cout << hello << endl;
return 0;
}
6.17
最新推荐文章于 2022-02-24 17:40:24 发布