C++ - Convert to lowercase and uppercase
C++ - Convert to lowercase and uppercase
CODE
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
string input = "Hello World";
transform(input.begin(), input.end(), input.begin(), ::tolower);
cout << "Converted to lowercase: " << input << endl;
transform(input.begin(), input.end(), input.begin(), ::toupper);
cout << "Converted to uppercase: " << input << endl;
//OUTPUT
//Converted to lowercase: hello world
//Converted to uppercase: HELLO WORLD
return 0;
}
Comments
Post a Comment