// The rule of bit operations is from the formula of the operations
// i.e The result of the bit operation depends on the binary form of the number and the operator
//From the rule, we know:
// The result of an AND(&) comparison is 1 when both bits being compared are 1s; otherwise the result is 0.
// The SHIFT(<< and >>) operator causes the bitss in an operand to be shifted to the left(right) by a given amount.
// So we can calculate by this rule and yield the following test code.
//For Turbo c++:
#include<stdio.h>
int main()
{
printf("5&4=%d",(5&4));
printf("4>>1=%d",(4>>1));
printf("5<<2=",(5<<2));
return 0;
}
//For Dev-C++ and VC++:
#include<iostream>
using namespace std;
#include<stdio.h>
#include<conio.h>
int main()
{
cout<<"5&4="<<(5&4)<<endl;
cout<<"4>>1="<<(4>>1)<<endl;
cout<<"5<<2="<<(5<<2)<<endl;
getche();
return 0;
}