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

int main() {
    string s;
    cin >> s;
    s[0] = toupper(s[0]); // 将首字母大写
    for (int i = 1; i < s.size(); i++) { // 从第二个字符开始遍历
        s[i] = tolower(s[i]); // 将后面的字符全部小写
    }
    cout << s << endl;
    return 0;
}
C++ 字符串首字母大写,其余小写转换程序

原文地址: https://www.cveoy.top/t/topic/oGvb 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录