• Register
100 points
7 4

This article will explain the method of converting an array which contains uppercase letters to lowercase. We can use this little program in a various way in our application. This article will contain a program, output, explanation.

tolower()

To convert uppercase letters to lowercase we can use tolower() function that converts characters to its lowercase if there is any. If the array does not contain any uppercase letter, then it remains unmodified. All the uppercase letters from A to Z is converted to lowercase from a to z. To use this function, we have to add a <cctype> header file.
 

Program

#include<iostream>
using namespace std;
int main()
{
    char name[20] = {"KODlogs will gRoW"};
    cout << "Lowercase version of " << name << " is" << endl;
    for (int i = 0; i < 20; i++)
    {
        putchar(tolower(name[i]));
    }
    return 0;
    
}
Here we take an array of definite size. I have defined the array in the program but you can ask a user to enter their own value using the cin operator. Then I iterate over the array till the end of the array and call the tolower() function.
 

Output

Lowercase version of KODlogs will gRoW is
kodlogs will grow
100 points
7 4