C++解题步骤
2025-11-27 16:57:39
发布于:北京
11阅读
0回复
0点赞
C++解题步骤
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main() {
string input_str;
// 读取输入字符串
cin >> input_str;
// 遍历字符串,将小写字母转换为大写
for (char &c : input_str) {
if (islower(c)) {
c = toupper(c);
}
}
// 输出结果
cout << input_str << endl;
return 0;
}
全部评论 1
还写上了注释
2025-11-27 来自 北京
0

有帮助,赞一个