C++ Program to Convert String into Lowercase

In this program, you'll learn to convert a given string into lowercase letters.



Source Code
#include<iostream>
using namespace std;

int main()
{
    int i;
    char str[20];

    cout<<"Enter the string..\n";
    gets(str);

    for(i=0; str[i]!= '\0'; i++)
    {
        if(str[i] >= 'A' && str[i] <='Z')
        {
            str[i] = str[i] + 32;
        }
    }
    cout<<"\nString in LOWERCASE is..\n";
    puts(str);
    return 0;
}
Output
Enter the string..
I am very to learn code!

String in LOWERCASE is..
i am very to learn code!