1#include<bits/stdc++.h>
2using namespace std;
3
4int main()
5{
6 string s = "Viet Nam";
7 transform(s.begin(), s.end(), s.begin(), ::toupper); //uppercase
8 cout << s << endl;
9 return 0;
10}
11
1/* toupper example */
2#include <stdio.h>
3#include <ctype.h>
4int main ()
5{
6 int i=0;
7 char str[]="Test String.\n";
8 char c;
9 while (str[i])
10 {
11 c=str[i];
12 putchar (toupper(c));
13 i++;
14 }
15 return 0;
16}
1std::string data = "This is a sample string.";
2// convert string to upper case
3std::for_each(data.begin(), data.end(), [](char & c){
4c = ::toupper(c);
5});
1int i = 0;
2 while(str[i])
3 {
4 if(str[i] == std::toupper(str[i]) && std::isalpha(str[i]) == 1024)
5 str[i]+= 32;
6 ++i;
7 }