cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
<< and >>
<< and >>
Jun 23, 2009 at 11:12am UTC
Null
(957)
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.
Jun 23, 2009 at 11:35am UTC
Bazzy
(6281)
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
Jun 23, 2009 at 11:36am UTC
Jun 23, 2009 at 12:33pm UTC
helios
(17574)
By the way, a<<b==a*2^b, and a>>b==a/2^b. / is integer division and ^ is exponentiation.
Jun 23, 2009 at 4:18pm UTC
Null
(957)
Now i understand, thanks!
Topic archived. No new replies allowed.