0
Write aprogram in C++ to shift no 10 to the left 2 bits
4 Antworten
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
0
thank you
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.