Question: using C++ Q4. In this question, you need to read an integer as a char array. Then find the largest k bits of the integer

Q4. In this question, you need to read an integer as a char array. Then find the largest k bits of the integer with their original sequence. For example, the input integer is 1432219 and k is given as 4 . Then the output should be 4329. The input first gives the value of k, and then the integer. Assume that k is larger than 0 and smaller than the length of the integer. The input integer will be less than 20 bits. It is better to store the input as a char array for convenient operations. Input the integer number: 136845398 Input the value of k: 3 The largest k bit is: 898 Sample 2: Input the integer number: 5378694010 Input the value of k : 4 The largest k bit is: 9410 Sample 3: Input the integer number: 900743112 Input the value of k: 4 The largest k bit is: 9743
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
