From 3542a9be676a2c26a5081c2ecb2c4aced7f3d78d Mon Sep 17 00:00:00 2001 From: Jae1015 <31164185+Jae1015@users.noreply.github.com> Date: Tue, 31 Oct 2017 23:11:25 +0530 Subject: [PATCH] Update operators.cpp --- operators.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/operators.cpp b/operators.cpp index 7388910..fa0fe24 100644 --- a/operators.cpp +++ b/operators.cpp @@ -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. @@ -16,4 +19,4 @@ int main(int argc, char const *argv[]){ cout << endl << int(floatValue); //type casting. return 0; -} \ No newline at end of file +}