I think the problem you have is understanding this pseudocode:
To test for each digit value, bitwise and 'i' with 'mask'
when the result for the bitwise and is true, print the number '1'
when the result for the bitwise and is false, print the number '0'
then shift mask one place to the right
It took me a few reads to understand excactly what he is saying, but what he wants is you to use the '&' operator on i and the mask to get a boolean value...

bool result = i & mask;

if (result)

cout << "1";

else

cout << "0";

shifting the mask looks like this:
this moves all the binary digits one place to the right... effectively multiplying everything by 2 or 2^1 more accurately.
Check out wikipedia's explination... you want the Shifts in C++ section and the AND sections:
http://en.wikipedia.org/wiki/Bitwise_operation
or something to that extent.