| 7 | #define endl '\n' |
| 8 | |
| 9 | int main(){ |
| 10 | cin.tie(0)->sync_with_stdio(0); |
| 11 | int a; |
| 12 | a=5; |
| 13 | int b; |
| 14 | b=10; |
| 15 | cout<<a<<" and "<<b<<" is "<<(a&b)<<endl;//bitwise and - when both the bits are true then return true |
| 16 | cout<<a<<" or "<<b<< " is "<<(a|b)<<endl;//bitwise or - when anyone of the bit is true then returs 1 |
| 17 | cout<<a<<" xor "<<b<<" is "<<(a^b)<<endl;//bitwise xor - when both the bits are same then returns 0 |
| 18 | |
| 19 | //bitwise complement operator |
| 20 | cout<<"~( a) is "<<~(a)<<endl; |
| 21 | |
| 22 | //left and right shift operator |
| 23 | a=5; |
| 24 | b=2; |
| 25 | cout<<"left shift = "<<(a<<b)<<endl; |
| 26 | //left shift all the bits by the factor of b [=a*2^b] |
| 27 | //right shift all the bits by the faccor of b [=a/2^b] |
| 28 | cout<<"right shift = "<<(a>>b)<<endl; |
| 29 | |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 |
nothing calls this directly
no outgoing calls
no test coverage detected