#include using namespace std; /** * Shows the use of * int toupper(int c) * * It is important to realize that this function takes an int and returns * an int but is intended to be used on a char. A char is a byte which is the * same as an int between 0 and 255. * However, notice that if you cout >> toupper('a'), it will print a number and not a character. * You can get around this by either casting the result to char or storing it as char. This is shown * below. */ int main() { char a = 'a'; // This prints an int out. cout << endl << "It is an int: " << toupper(a) << endl; // With a cast, it prints a char. cout << "Cast to a char: " << (char) toupper(a) << endl; // This uses type coercion to convert the into to a char char A = toupper(a); // and prints a char cout << "After type coercion: " << A << endl << endl; }