C++ Program to convert uppercase string to lowercase


In this program, You will learn how to convert uppercase string to lowercase in C++.


Enter a String :XIIth

Lowercase String is :xiith


Example: How to convert uppercase string to lowercase in C++

Run it Now
#include<iostream>
using namespace std;

int main() {

    char str[100];
    int i = 0;

    cout << "Enter a String :";
    cin.getline(str, 100);

    while (str[i] != '\0') {
        i++;
    }

    for (int j = 0; j < i; j++) {
        if (str[j] >= 65 && str[j] <= 90) {
            str[j] = str[j] + 32;
        }
    }
    cout << "\nLowercase String is :" << str;

    return 0;
}

Output:

Enter a String :LeveL
Lowercase String is :level