C++ 字符串大小写转换 - 将所有小写字母转换为大写字母
#include <iostream>
#include <string>
#include <cctype>
int main() {
std::string str;
std::getline(std::cin, str);
for (int i = 0; i < str.length(); i++) {
if (std::islower(str[i])) {
str[i] = std::toupper(str[i]);
}
}
std::cout << str << std::endl;
return 0;
}
原文地址: http://www.cveoy.top/t/topic/DWR 著作权归作者所有。请勿转载和采集!