fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. main()
  6.  
  7. {
  8.  
  9. unsigned int a = 60; // 60 = 0011 1100
  10.  
  11. unsigned int b = 13; // 13 = 0000 1101
  12.  
  13. int c = 0;
  14.  
  15.  
  16.  
  17. c = a & b; // 12 = 0000 1100
  18.  
  19. cout << "Line 1 - Value of c is : " << c << endl ;
  20.  
  21.  
  22.  
  23. c = a | b; // 61 = 0011 1101
  24.  
  25. cout << "Line 2 - Value of c is: " << c << endl ;
  26.  
  27.  
  28.  
  29. c = a ^ b; // 49 = 0011 0001
  30.  
  31. cout << "Line 3 - Value of c is: " << c << endl ;
  32.  
  33.  
  34.  
  35. c = ~a; // -61 = 1100 0011
  36.  
  37. cout << "Line 4 - Value of c is: " << c << endl ;
  38.  
  39.  
  40.  
  41. c = a << 2; // 240 = 1111 0000
  42.  
  43. cout << "Line 5 - Value of c is: " << c << endl ;
  44.  
  45.  
  46.  
  47. c = a >> 2; // 15 = 0000 1111
  48.  
  49. cout << "Line 6 - Value of c is: " << c << endl ;
  50.  
  51.  
  52.  
  53. return 0;
  54.  
  55. }
Success #stdin #stdout 0s 4432KB
stdin
Standard input is empty
stdout
Line 1 - Value of c is : 12
Line 2 - Value of c is: 61
Line 3 - Value of c is: 49
Line 4 - Value of c is: -61
Line 5 - Value of c is: 240
Line 6 - Value of c is: 15