#include #include //for the iomanipulator setw #include using namespace std; int main() { //Start with a 1 all the way to the right, in bit poistion 0. int mask {0x1}; //binary 00000000 00000000 00000000 00000001 /* and keep doubling it by shifting it farther and farther left: 00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000010 00000000 00000000 00000000 00000100 00000000 00000000 00000000 00001000 etc. */ for (int i {0}; i < 31; ++i) { //i is the bit position cout << setw(2) << i << " " << setw(10) << mask << "\n"; mask <<= 1; //means mask = mask << 1; } return EXIT_SUCCESS; }