0

Write aprogram in C++ to shift no 10 to the left 2 bits

26th Apr 2017, 10:05 AM
Mutlu Ol Yeter
4 odpowiedzi
0
#include <iostream> #include <bitset> int main() { int x = 10; int y = x << 2; std::cout << "x = " << std::bitset<8>(x) << std::endl; std::cout << "y = " << std::bitset<8>(y) << std::endl; return 0; } Prints: x = 00001010 y = 00101000
26th Apr 2017, 7:18 PM
Mason Krei
Mason Krei - avatar
0
thank you
28th Apr 2017, 11:33 AM
Mutlu Ol Yeter
0
Sure. If you wouldn't mind, use the check mark under the Up/Down arrow to mark my response as the answer. Thank you.
28th Apr 2017, 5:25 PM
Mason Krei
Mason Krei - avatar