#include <iostream>
#include <string>
using namespace std;
int main() {
string str;
cout << "Enter a string in uppercase: ";
getline(cin, str);
for (int i = 0; i < str.length(); i++) {
if (str[i] >= 'A' && str[i] <= 'Z') {
str[i] = str[i] + 32;
}
}
cout << "The string in lowercase is: " << str << endl;
return 0;
}
Enter a string in uppercase: FREETIMELEARNING.COM
The string in lowercase is: freetimelearning.com
getline()
, and then uses a for
loop to iterate through each character in the string.