I understand
11001110
& 10011000
= 10001000
but I want to test it myself
so I declare unsigned char and print it out, but it just gives me blank.
unsigned char result;
result= 11001110 & 10011000;
cout<<result;
Also tested with unsigned int, but it gives me 0, which is not what I expected
11001110
and 10011000
aren't binary numbers (at least in the compiler's mind).
Binary 11001110
is 206
, and 10011000
is 152
, so you actually want (I think):
result = 206 & 152;
or use a std::bitset
and then print result as a binary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With