Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ int main(int argc, char const *argv[]){

int testValue = 15;
cout << testValue << endl;
testValue >>= 2; //Right Shift by 2 of testVAlue which is 15, in binary 0000 1111 which outputs 0000 0011.
testValue >>= 2; /*Right Shift by 2 of testVAlue which is 15, in binary 0000 1111
which outputs 0000 0011 i.e floor(15/(2*2))=3.*/

cout << testValue << endl;
testValue <<= 2; //Left Shift by 4 of testValue which is now 3 (0000 0011) which outputs 0011 0000 which is 12.
cout << testValue << endl;
Expand All @@ -16,4 +18,4 @@ int main(int argc, char const *argv[]){

cout << endl << int(floatValue); //type casting.
return 0;
}
}