fork download
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int a = 7;
  6. int b = 10;
  7. cout << (a & b) << endl; // Bitwise AND
  8. cout << (a | b) << endl; // Bitwise OR
  9. cout << (a ^ b) << endl; // Bitwise XOR
  10. cout << (a << b) << endl; // Bitwise left shift print a*2^10
  11. cout << (a >> b) << endl; // Bitwise rigth shift print 0
  12. cout << (~a) << endl; // Bitwise Not is a unary opeator too.
  13. return 0;
  14. }
Success #stdin #stdout 0s 4348KB
stdin
Standard input is empty
stdout
2
15
13
7168
0
-8