#include<iostream>
using namespace std;
int main()
{
cout << (3 & 5)<<endl;
cout << (3 | 5) << endl;
cout << (-3 ^ 5) << endl;
cout << (~- 5) << endl;
int a = 4;
int res = a << 2;//扩大2^2
cout << res << endl;
res = a >> 2; //除以2^2
cout << res << endl;
//一个数按位异或另一个数两次,得到本身
int x = 10, y = 20, z = x^y^x;
cout << z << endl;
//交换两个数
x = x^y;
y = x^y;
x = x^y;
cout << x << ' ' << y << endl;
system("pause");
return 0;
}