From 8fcaf6c291882cb495764f86f6f521b067a0bcde Mon Sep 17 00:00:00 2001 From: Jae1015 <31164185+Jae1015@users.noreply.github.com> Date: Tue, 31 Oct 2017 23:08:10 +0530 Subject: [PATCH 1/2] Update operators.cpp --- operators.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/operators.cpp b/operators.cpp index 7388910..5f39c14 100644 --- a/operators.cpp +++ b/operators.cpp @@ -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; @@ -16,4 +18,4 @@ int main(int argc, char const *argv[]){ cout << endl << int(floatValue); //type casting. return 0; -} \ No newline at end of file +} From f6d15d859cefdff46a85980130f50dab5e916632 Mon Sep 17 00:00:00 2001 From: Jae1015 <31164185+Jae1015@users.noreply.github.com> Date: Tue, 31 Oct 2017 23:14:14 +0530 Subject: [PATCH 2/2] Update operators.cpp --- operators.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operators.cpp b/operators.cpp index 5f39c14..064ae15 100644 --- a/operators.cpp +++ b/operators.cpp @@ -6,7 +6,7 @@ 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 i.e floor(15/(2*2))=3. + 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.