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
7 changes: 5 additions & 2 deletions operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ int main(int argc, char const *argv[]){
cout << testValue << endl;
testValue >>= 2; //Right Shift by 2 of testVAlue which is 15, in binary 0000 1111 which outputs 0000 0011.
cout << testValue << endl;
testValue <<= 2; //Left Shift by 4 of testValue which is now 3 (0000 0011) which outputs 0011 0000 which is 12.
testValue <<= 2; /*Left Shift by 2 of testValue which is now 3 (0000 0011) which outputs
0011 0000 which is 12 i.e. 3*2*2=12 as shift is made by 2 and with one shift
number gets shifted by 2. */

cout << testValue << endl;

testValue > 0 ? cout << "Yes" : cout << "No"; // (condition ? if true : else) - One liner if else.
Expand All @@ -16,4 +19,4 @@ int main(int argc, char const *argv[]){

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