Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace::std;
- void main() {
- unsigned int a = 4, b = 8;
- cout << "and: " << (a & b) << endl;
- cout << "or: " << (a | b) << endl;
- cout << "xor: " << (a ^ b) << endl;
- cout << "inversion: " << ~a << endl;
- int c = 58, d = 15;
- cout << "c " << (c & 32) << endl;
- cout << "d " << (d & 32) << endl;
- unsigned char e = 221;
- cout << "e " << ~e << endl;
- cout << "f ";
- int f = 5;
- for(int i = 0; i < 5; i++)
- {
- f = f << 1;
- cout << f << "\t";
- }
- cout << endl;
- cout << "g ";
- int g = 341;
- for(int i = 0; i < 5; i++)
- {
- g = g >> 1;
- cout << g << "\t";
- }
- cout << g << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement