1char choice;
2// it will instantly transform it to upper case without the need
3// to convert it to int first
4choice = (char)toupper(choice);
5
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
1int result = toupper(charecterVariable);// return the int that corresponding upper case char
2//if there is none then it will return the int for the original input.
3//can convert int to char after
4char result2 = (char)toupper(variableChar);