Last active
August 12, 2017 08:59
-
-
Save j2doll/1923063ad945b76ae16503b94beab98b to your computer and use it in GitHub Desktop.
Demonstrate shift operators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// shift.cpp | |
// code from MSDN | |
// Demonstrate shift operators | |
#include <iostream> | |
using namespace std; | |
int _tmain() { | |
cout << "5 times 2 is " << (5 << 1) << endl; // 5 × 2 = 10 | |
cout << "20 divided by 4 is " << (20 >> 2) << endl; // 20 ÷ 4 = 5 | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment