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#include <cctype>
2#include <iostream>
3#include <cstring>
4#include <cstdio>
5
6using namespace std;
7
8int main()
9{
10 char str[] = "John is from USA.";
11
12 cout << "The uppercase version of \"" << str << "\" is " << endl;
13
14 for (int i=0; i<strlen(str); i++)
15 putchar(toupper(str[i]));
16
17 return 0;
18}
1#include <iostream>
2#include <string>
3using namespace std;
4
5int main()
6{
7 char letter;
8
9 cout << "You will be asked to enter a character.";
10 cout << "\nIf it is a lowercase character, it will be converted to uppercase.";
11 cout << "\n\nEnter a character. Press . to stop: ";
12
13 cin >> letter;
14
15 if(islower(letter))
16 {
17 letter = isupper(letter);
18 cout << letter;
19 }
20
21 while(letter != '.')
22 {
23 cout << "\n\nEnter a character. Press . to stop: ";
24 cin >> letter;
25
26 if(islower(letter))
27 {
28 letter = toupper(letter);
29 cout << letter;
30 }
31 }
32
33 return 0;
34}
35