C++ program to convert given string to lower case
Following C++ program shows you how to convert given string to lower case.
#include <iostream>
#include <string>
#include <algorithm>
int main() {
std::string data = "SAMPLE STRING";
// convert string to back to lower case
std::for_each(data.begin(), data.end(), [](char & c) {
c = ::tolower(c);
});
std::cout << "In Lower Case : " << data << std::endl;
}
Output:
sample string
Try it Online here https://onecompiler.com/cpp/3x73f94pa