10
After left shift = 20 After right shift = 5
void operator_q7_bit_shift() {
int num = 5; // Binary: 101
cout << "Original number: " << num << endl;
cout << "Left shift by 1 (num << 1): " << (num << 1) << endl; // 10 (multiply by 2)
cout << "Left shift by 2 (num << 2): " << (num << 2) << endl; // 20 (multiply by 4)
cout << "Right shift by 1 (num >> 1): " << (num >> 1) << endl; // 2 (divide by 2)
}
void operator_q7_bit_shift() {
int num = 5; // Binary: 101
cout << "Original number: " << num << endl;
cout << "Left shift by 1 (num << 1): " << (num << 1) << endl; // 10 (multiply by 2)
cout << "Left shift by 2 (num << 2): " << (num << 2) << endl; // 20 (multiply by 4)
cout << "Right shift by 1 (num >> 1): " << (num >> 1) << endl; // 2 (divide by 2)
}