0
What means the output of cout<<(variable1<<variable2); and cout<<(variable1>>variable2); ?
2 ответов
+ 2
3 base 10 = 11 base 2
if you left shift (11)2 (based 2)
you just add 0's on the right.
if a = 000011;
and you do
a<<3 (left shift a by 3)
What you are doing is adding zeroes at the end essentially.
a = 011000;
On the math part
left shift made
a = a *(2^3)
if you do right shift
a>>4
a = 000001 (one of the bits fell off)
Its same as -
a = a/ (2^4)
0
Thank you so much guys!