Changing a capital letter (read from cin) to lower case?

前端 未结 5 2033
独厮守ぢ
独厮守ぢ 2021-01-29 08:13

i wanna change the capital cin to lower case for the input , for example if cin>> one one=R it should be r so it convert it automatically

<
5条回答
  •  被撕碎了的回忆
    2021-01-29 08:19

    the transform is the right way to do it, i think, you just need to include the algorithm library

    #include 
    #include 
    #include 
    
    std::transform(one.begin(), one.end(), one.begin(), ::tolower); 
    std::transform(two.begin(), two.end(), two.begin(), ::tolower);
    

提交回复
热议问题