convert all the characters of a given string to uppercase in c++ code example
Example 1: convert all characters in string to uppercase c++
transform(str.begin(), str.end(), str.begin(), ::toupper);
Example 2: c++ convert lowercase to uppercase
/* toupper 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 (toupper(c));
i++;
}
return 0;
}
Example 3: uppercase capitalise character in string c++
str[i] = toupper(str[i]);