#include #include #include //for the function tolower using namespace std; /* Use "bitwise or" to change the character uppercase 'A' to lowercase 'a'. (We're really changing the number 65 to 97.) The "bitwise or" turns on bit number 5 of the character c, converting it from lower to uppercase. 01000001 The ASCII code of uppercase 'A' is 65. | 00100000 The mask 0x20 has 1 in bit position 5, and 0 everywhere else. ---------- 01100001 The ASCII code of lowercase 'a' is 97. */ int main() { char c {'A'}; //Put 01000001 into c (in decimal, that's 65) cout << c << "\n"; c |= 0x20; //means c = c | 0x20; cout << c << "\n\n"; char d {'B'}; //Put 01000010 into c (in decimal, that's 66) cout << d << "\n"; d = tolower(d); //changes d to 98 (in binary, that's 01000010) cout << d << "\n"; return EXIT_SUCCESS; }