#include <iostream> using namespace std; int main() { // different ways to specify 25 int value1 = 25; int value2 = 0b11001; // 0b.. binary int value3 = 0x19; // 0x.. hex int value4 = 031; // 0... octal // all display 25 cout << "from base 10: " << value1 << endl; cout << "from base 2: " << value2 << endl; cout << "from base 16: " << value3 << endl; cout << "from base 8: " << value4 << endl; // displaying 25 in different bases // * once hex is put in cout it will print in hex until oct or dec shows up // * no option for binary cout << hex; cout << value1 << ", " << value2 << ", " value3 << ", " << value4 << endl; // 19 (hex versions of 25) cout << oct; cout << value1 << ", " << value2 << ", " value3 << ", " << value4 << endl; // 31 (oct versions of 25) cout << dec; cout << value1 << ", " << value2 << ", " value3 << ", " << value4 << endl; // 25 (dec versions of 25) char upper = 'A'; cout << "upper: " << upper << endl; // same effect since using same mask (once in binary, once in hex) char lower1 = upper | 0b00100000; // 20 in hex char lower2 = upper | 0x20; cout << "lower1: " << lower1 << endl; cout << "lower2: " << lower2 << endl; return 0; }