<< and >>

Hello, what is << and >>? And how to use them? (example would be great!). I'm not about cin and cout , i'm about binary.
Thanks for replies.
They are bit shifting operators
eg:
you have number 12, in bnary is 00001100
If you use 12<<3 you move the bits in by three positions to the left, the result is 01100000 (decimal 96).
the >> operators does the same thing on the other direction

http://en.wikipedia.org/wiki/Arithmetic_shift
Last edited on
By the way, a<<b==a*2^b, and a>>b==a/2^b. / is integer division and ^ is exponentiation.
Now i understand, thanks!
Topic archived. No new replies allowed.