题目描述
解题思路
把所有大写字母转换成小写,其它字符不变。
可以用cctype中的tolower函数。
参考代码
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main()
{
string s;
while (getline(cin,s)){
for (int i = 0;i < s.length();i++)
if (isalpha(s[i]))
cout << (char)tolower(s[i]);
else
cout << s[i];
cout << endl;
}
return 0;
}