how can you check an individual binary digit in c++
This question already has an answer here:
To get bit n
state (returns bit n as 0 or 1):
(value>>n) & 1
To set bit n
state (flag is 0 or 1):
value = (value & ~(1 << n)) | (flag << n)
链接地址: http://www.djcxy.com/p/28802.html