JamesCurtis 2022-01-28 23:01 采纳率: 100%
浏览 87
已结题

请问C++中::tolower是啥意思?

问题遇到的现象和发生背景

大小写转换时候遇到的::tolower

问题相关代码,请勿粘贴截图
#include<iostream>
#include "algorithm"
#include "cctype"

using namespace std;

int main() {
    string string1 = "I LOVE YOU";
    transform(string1.begin(), string1.end(), string1.begin(), ::tolower);
    cout << string1 << endl;

    return 0;
}


运行结果及报错内容

img

我的解答思路和尝试过的方法

https://zh.cppreference.com/w/cpp/algorithm/transform
文档里面说的是
template< class InputIt, class OutputIt, class UnaryOperation >
constexpr OutputIt transform( InputIt first1, InputIt last1, OutputIt d_first,
UnaryOperation unary_op );
也就是这个类型UnaryOperation ,没看懂啥意思

我想要达到的结果
  • 写回答

2条回答 默认 最新

查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 2月5日
  • 请采纳用户回复 1月29日
  • 已采纳回答 1月28日
  • 创建了问题 1月28日