| View previous topic :: View next topic |
| Author |
Message |
Aviar³ Grandmaster Cheater
Reputation: 50
Joined: 03 Jan 2008 Posts: 655 Location: Canada
|
Posted: Thu Jan 08, 2009 7:34 am Post subject: Programming Help (Bitwise shift C++) |
|
|
I can not understand what << and >> do in terms of the C programming language. While its simple enough with strings (an append operator) or with the use of the iostream header, in context of ints I cant seem to understand it. I know what a bit is, what shift is, and what left is, but I dont know what a shift left bitwise operator is, the same goes for right too.
P.S. Since I know that nearly everyone here is a rep whore, the first person to help me understand it (no copy and pasting random tutorials or giving me links, but seriously helping) will get +rep.
_________________
This is the inception of deception, checking the depth of your perception.
 |
|
| Back to top |
|
 |
92Garfield I'm a spammer
Reputation: 57
Joined: 20 Dec 2007 Posts: 5871 Location: Banana Republic Germany
|
Posted: Thu Jan 08, 2009 8:06 am Post subject: |
|
|
<< and >> show input/ouput in console
now go to generaly programming
_________________
|
|
| Back to top |
|
 |
Codeslinger I post too much
Reputation: 1
Joined: 11 Oct 2007 Posts: 3652 Location: Midwest, United States of America
|
|
| Back to top |
|
 |
SGL Grandmaster Cheater
Reputation: 14
Joined: 04 May 2007 Posts: 758
|
Posted: Thu Jan 08, 2009 12:41 pm Post subject: |
|
|
<< means greater greater than
>> means less less than
_________________
I'm SirGodlike
 |
|
| Back to top |
|
 |
Rick. Grandmaster Cheater
Reputation: 6
Joined: 02 Jul 2008 Posts: 657 Location: In the netherlands
|
Posted: Thu Jan 08, 2009 12:44 pm Post subject: |
|
|
look at your left hand.
congratulations, u found left!
look at your right hand.
Congratulations, u found right!
|
|
| Back to top |
|
 |
Pedo Bear Expert Cheater
Reputation: 0
Joined: 16 Aug 2007 Posts: 124
|
Posted: Thu Jan 08, 2009 12:45 pm Post subject: |
|
|
| freezeGTA wrote: | look at your left hand.
congratulations, u found left!
look at your right hand.
Congratulations, u found right! | no u
|
|
| Back to top |
|
 |
Rick. Grandmaster Cheater
Reputation: 6
Joined: 02 Jul 2008 Posts: 657 Location: In the netherlands
|
Posted: Thu Jan 08, 2009 12:46 pm Post subject: |
|
|
| PANIC ATTACK wrote: | | freezeGTA wrote: | look at your left hand.
congratulations, u found left!
look at your right hand.
Congratulations, u found right! | no u |
i already did!
|
|
| Back to top |
|
 |
Cheat Engine User Something epic
Reputation: 61
Joined: 22 Jun 2007 Posts: 2071
|
Posted: Thu Jan 08, 2009 1:00 pm Post subject: |
|
|
| 92Garfield wrote: | << and >> show input/ouput in console
now go to generaly programming | Holy shit, read the fucking title!
it moves the bits of your value the many times as you state.
Ill take 4 as an example, thats 0100 in binary
Bitwise shift left means it shift it one time to the left, making it 1000, resulting in a value of 8.
Shifting again will result in 0001, or 1.
Etc.
Same goes for right
|
|
| Back to top |
|
 |
Aviar³ Grandmaster Cheater
Reputation: 50
Joined: 03 Jan 2008 Posts: 655 Location: Canada
|
Posted: Thu Jan 08, 2009 2:01 pm Post subject: |
|
|
| Holland wrote: | | 92Garfield wrote: | << and >> show input/ouput in console
now go to generaly programming | Holy shit, read the fucking title!
it moves the bits of your value the many times as you state.
Ill take 4 as an example, thats 0100 in binary
Bitwise shift left means it shift it one time to the left, making it 1000, resulting in a value of 8.
Shifting again will result in 0001, or 1.
Etc.
Same goes for right |
How does one determine what is shifted? Obviously there are numbers whose binary representation may contain multiple zeroes and ones. Either way, you won the rep of you choice.
_________________
This is the inception of deception, checking the depth of your perception.
 |
|
| Back to top |
|
 |
92Garfield I'm a spammer
Reputation: 57
Joined: 20 Dec 2007 Posts: 5871 Location: Banana Republic Germany
|
Posted: Thu Jan 08, 2009 2:05 pm Post subject: |
|
|
| Holland wrote: | | 92Garfield wrote: | << and >> show input/ouput in console
now go to generaly programming | Holy shit, read the fucking title!
it moves the bits of your value the many times as you state.
Ill take 4 as an example, thats 0100 in binary
Bitwise shift left means it shift it one time to the left, making it 1000, resulting in a value of 8.
Shifting again will result in 0001, or 1.
Etc.
Same goes for right |
I made a calc in C++
using cin >> stuff and cout << "stuff"
_________________
|
|
| Back to top |
|
 |
Aviar³ Grandmaster Cheater
Reputation: 50
Joined: 03 Jan 2008 Posts: 655 Location: Canada
|
Posted: Thu Jan 08, 2009 2:09 pm Post subject: |
|
|
| 92Garfield wrote: | | Holland wrote: | | 92Garfield wrote: | << and >> show input/ouput in console
now go to generaly programming | Holy shit, read the fucking title!
it moves the bits of your value the many times as you state.
Ill take 4 as an example, thats 0100 in binary
Bitwise shift left means it shift it one time to the left, making it 1000, resulting in a value of 8.
Shifting again will result in 0001, or 1.
Etc.
Same goes for right |
I made a calc in C++
using cin >> stuff and cout << "stuff" |
The << and >> operator has many uses, its all based on context. Also I program (or am starting to) using the Win API.
_________________
This is the inception of deception, checking the depth of your perception.
 |
|
| Back to top |
|
 |
Cheat Engine User Something epic
Reputation: 61
Joined: 22 Jun 2007 Posts: 2071
|
Posted: Fri Jan 09, 2009 5:08 am Post subject: |
|
|
| Aviar wrote: | | Holland wrote: | | 92Garfield wrote: | << and >> show input/ouput in console
now go to generaly programming | Holy shit, read the fucking title!
it moves the bits of your value the many times as you state.
Ill take 4 as an example, thats 0100 in binary
Bitwise shift left means it shift it one time to the left, making it 1000, resulting in a value of 8.
Shifting again will result in 0001, or 1.
Etc.
Same goes for right |
How does one determine what is shifted? Obviously there are numbers whose binary representation may contain multiple zeroes and ones. Either way, you won the rep of you choice. | Usually you shift a certain entered value. it does it for you, just showing you how it's done.
And I didnt need to get rep, but this obvious shit had to be answered correctly.
|
|
| Back to top |
|
 |
Deletion I post too much
Reputation: 0
Joined: 22 Jun 2006 Posts: 2148 Location: Underground
|
Posted: Fri Jan 09, 2009 3:27 pm Post subject: |
|
|
weeeeeeeeeeeeeeeeeeeeeeee random spam.
_________________
Bitch, please.
| redslothx wrote: | | oh im a man so respect the penis powers |
|
|
| Back to top |
|
 |
|