+ 4

How do you deal with shift in cpp?

let's assume this sample code... jump to the point... int x= 5; //using a shift right or left... //is it cout << <<x; //or x=<<x; cout<<x;

7th Jan 2018, 2:11 AM
Otumian Empire
Otumian Empire - avatar
2 Antworten
+ 4
When bitshifting, you always have to specify by how much you want to shift. cout << (x << 1); Shifts left by 1 bit and prints the result.
7th Jan 2018, 2:25 AM
Schindlabua
Schindlabua - avatar
+ 3
thanks..
7th Jan 2018, 10:34 AM
Otumian Empire
Otumian Empire - avatar