I am currently participating in the C ++ exam. One of the issues in practice is:
What is the result of this statement.
cout <<(11>>1)<<1<<endl;
As I can see. 11 contains the binary equivalent
1011.
Shifting this binary number from 1 bit to the right makes it:
0101
Then shifting this number one left makes it
1010
Which is rated to 10.
However, by running the same statement in my compiler, it says that the number is estimated to 51. Can someone explain this to me?
source share