首页 > 编程语言 > 详细

C++字符串大小写转换的库函数

时间:2020-03-28 00:40:49      阅读:91      评论:0      收藏:0      [点我收藏+]
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

string str;

int main()
{
    cout << "请输入一个包含大小写字母的字符串: " << endl;
    cin >> str;

    transform(str.begin(), str.end(), str.begin(), ::tolower);
    cout << "转小写: " << str << endl;

    transform(str.begin(), str.end(), str.begin(), ::toupper);
    cout << "转大写: " << str << endl;

    system("pause");
    return EXIT_SUCCESS;
}

 

C++字符串大小写转换的库函数

原文:https://www.cnblogs.com/Es-war/p/12584986.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!