+ 1

What is the use of >> in c++?

plz

5th Mar 2017, 7:49 AM
divyansh garg
divyansh garg - avatar
5 odpowiedzi
+ 8
Aaaaaa I keep forgetting >> and << do something else! >_<
5th Mar 2017, 7:54 AM
Tamra
Tamra - avatar
+ 1
It is an operator so it can be override but its first use is to do a binary offset to the right. Example : 7 in binary is 000111 (I don't know how many zero there is to the left) 7>>1 is 7 with one shift to the right so it gives 000011 which is 3 in decimal 7>>2 is 7 with two shifts to the right so it gives 000001 which is 1 in decimal 7>>3 is 7 with three shifts to the right so it gives 000000 which is 0 in decimal
5th Mar 2017, 7:53 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
<< is like >> but the offset is done to the right :)
5th Mar 2017, 7:55 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
easiest way to remember which is used for what.. the one pointing to the right >> is the one used for write (input from user) which will then remind you that << is for output
6th Mar 2017, 10:03 AM
Ditshego Mosotho
Ditshego Mosotho - avatar
+ 1
>> is the bitwise right shift operator. see post https://www.sololearn.com/Discuss/173715/?ref=app
14th May 2017, 7:12 AM
ifl
ifl - avatar