c++ convert to lowercase code example
Example 1: tolower in c++
#include <cctype>
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
char str[] = "John is from USA.";
cout << "The lowercase version of \"" << str << "\" is " << endl;
for (int i=0; i<strlen(str); i++)
putchar(tolower(str[i]));
return 0;
}
Example 2: c++ string functions lowercase
transform(su.begin(), su.end(), su.begin(), ::toupper);
transform(sl.begin(), sl.end(), sl.begin(), ::tolower);