0

What is the output and how dose it came ? #include <iostream> int main() { std::cout << (10 & 6) << std::endl; std::cout << (10 | 6) << std::endl; return 0; }

4th Jun 2017, 12:39 AM
Omar Abdullah
Omar Abdullah - avatar
3 odpowiedzi
+ 5
& and | are bitwise operators in c++ so it will do operation using each binary bits of the operant, in given code binary of 10 - 1010 and 6 - 0110 so 1&1 =1 1&0=0 0&1=0 0&0=0 1010 &&&& 0110 -------- 0010 so 10&6 will be 0010 = 2 similarly 1|1 =1 1|0=1 0|1=1 0|0=0 so 10|6 will be 1110=14
4th Jun 2017, 12:52 AM
ASHMIL HUSSAIN
ASHMIL HUSSAIN - avatar
0
Thx hussain got it . Legacy , i didn't get your point . Thx all . Text me back ASHMIL HUSSAIN at x.333 @ msn . com
4th Jun 2017, 2:29 AM
Omar Abdullah
Omar Abdullah - avatar
0
u can contact me in ashmilhussain@gmail.com
4th Jun 2017, 7:06 AM
ASHMIL HUSSAIN
ASHMIL HUSSAIN - avatar