Bitwise operators
Bitwise operators work after the given operands are converted to their binary equivalent value.
Learning Objectives
 Understanding the concept of bitwise operators with the help of bitwise and & and bitwise or  operators.
Source Code

Run Output
Code Understanding
z=x&y;
here the value of x which is 81 and y which is 61 in this example will be converted to binary equivalents
01010001
00111101
Now match vertically the columns bitwise. Mark a 1 where 1 is present in both top and bottom row. This will yield
00010001
Now convert this value back to decimal. This will result in a value of 17.
z=xy;
In this case instead of check for 1 present in both top and bottom row, check for 1 present in any of the row. This will yield.
01111101
Converting this to decimal will yield 125.
Notes
The list of bitwise operators is as follows:
& – Bitwise AND
 – Bitwise OR (inclusive OR)
^ – Bitwise exclusive OR
~ – Bitwise unary complement (Bit inversion)
<< – Bitwise left shift
>> – Bitwise right shift
You can try other combinations of bitwise arithmetic operations.
<< and >> are visibly similar to IO insertion and IO extraction symbols used with cout and cin respectively, but they operate as bitwise operators when operands on both side are mathematical numbers.
Suggested Filename(s): operatorsbitwise.cpp, bitwisedemo.cpp, bitop.cpp
CSKC Created: 16Dec2017  Updated: 28Aug2018