How to make a string all lowercase in C++ code example
Example 1: how to compare lower case character to uppercase cpp
for(int i=0;i<str.size();i++){
int c = str[i];
if (islower(c))
str[i] = toupper(c);
}
Example 2: function to write a string in loercase in c++
/* tolower example */
#include <stdio.h>
#include <ctype.h>
int main ()
{
int i=0;
char str[]="Test String.\n";
char c;
while (str[i])
{
c=str[i];
putchar (tolower(c));
i++;
}
return 0;
}