-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbitwise_proves.cpp
More file actions
41 lines (34 loc) · 1.25 KB
/
Copy pathbitwise_proves.cpp
File metadata and controls
41 lines (34 loc) · 1.25 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>
using namespace std;
main()
{
unsigned int a = 60; // 60 = 0011 1100
unsigned int b = 13; // 13 = 0000 1101
unsigned int c = 5;
int d = 0;
d = a & b; // 12 = 0000 1100
cout << "Line 1 - Value of c is : " << d << endl ;
d = a | b; // 61 = 0011 1101
cout << "Line 2 - Value of c is: " << d << endl ;
d = a ^ b; // 49 = 0011 0001
cout << "Line 3 - Value of c is: " << d << endl ;
d = ~a; // -61 = 1100 0011
cout << "Line 4 - Value of c is: " << d << endl ;
d = a << 2; // 240 = 1111 0000
cout << "Line 5 - Value of c is: " << d << endl ;
d = a >> 2; // 15 = 0000 1111
cout << "Line 6 - Value of c is: " << d << endl ;
d = a | b ^ c;
cout << "Line 7 - Value of a | b ^ c is: " << d << endl;
d = a | (b^c);
cout << "Line 8 - Value of a | (b^c) is : " << d << endl;
d = (a | b) ^ c;
cout << "Line 9 - Value of (a | b) ^ c is : " << d << endl;
d = a ^ b & c ;
cout << "Line 10 - Value of a ^ b & c is: " << d << endl ;
d= a ^ (b & c);
cout << "Line 11 - Value of a ^(b & c) is : " << d << endl;
d = (a^b) & c;
cout << "Line 12 - Value of (a^b) & c is : " << d << endl;
return (0);
}