bitwise operations in c++, how to actually use it? -


i understand

  11001110 & 10011000 = 10001000 

but want test myself

so declare unsigned char , print out, gives me blank.

unsigned char result; result= 11001110 & 10011000;  cout<<result; 

also tested unsigned int, gives me 0, not expected

11001110 , 10011000 aren't binary numbers (at least in compiler's mind).

binary 11001110 206, , 10011000 152, want (i think):

result = 206 & 152; 

or use std::bitset , print result binary.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -