make a character in a string to uppercase cpp code example
Example 1: convert whole string to uppercase c++
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s = "Viet Nam";
transform(s.begin(), s.end(), s.begin(), ::toupper); //uppercase
cout << s << endl;
return 0;
}
Example 2: convert all characters in string to uppercase c++
transform(str.begin(), str.end(), str.begin(), ::toupper);