#include #include //for the iomanipulator setw #include using namespace std; int main() { //Start with a 1. int mask {0x40000000}; //binary 01000000 00000000 00000000 00000000 /* and keep halving it by shifting it farther and farther right: 01000000 00000000 00000000 00000000 00100000 00000000 00000000 00000000 00010000 00000000 00000000 00000000 00001000 00000000 00000000 00000000 etc. */ for (int i {30}; i >= 0; --i) { cout << setw(2) << i << " " << setw(10) << mask << "\n"; mask >>= 1; //means mask = mask >> 1; } return EXIT_SUCCESS; }