-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbit.cpp
More file actions
28 lines (20 loc) · 666 Bytes
/
Copy pathbit.cpp
File metadata and controls
28 lines (20 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
using namespace std;
int main() {
int a = 7;
int b = 7;
int c = 0;
c = a & b; // and
cout << "Line 1 - Value of c is : " << c << endl ;
c = a | b; // or
cout << "Line 2 - Value of c is: " << c << endl ;
c = a ^ b; // xor
cout << "Line 3 - Value of c is: " << c << endl ;
c = ~a; // -compliment
cout << "Line 4 - Value of c is: " << c << endl ;
c = a << 2; // shift operator
cout << "Line 5 - Value of c is: " << c << endl ;
c = a >> 2; // shift operator
cout << "Line 6 - Value of c is: " << c << endl ;
return 0;
}