Please answer this C++ programming question to receive 1500 points. explain your
ID: 3560535 • Letter: P
Question
Please answer this C++ programming question to receive 1500 points. explain your answer briefly . Thanks.
Write a function which gets a positive integer as an input, and print out the digit sum of the binary representation of that integer. In other words, your function must return the number of set bits (1 bits) of the binary representation of that integer. So if the input has n bits that were 1, then you must print n for your output. For instance, binary representation of 13 is 1011. Thus, it has 3 bits equal to one. So the return value of the function should be 3. This number is called the Hamming Weight and has many applications in computer science including computer security. Here are a few input/output examples: Input: 13 Output: 13 (Since 13 = (1101) rightarrow 3 bits are 1) Input: 16 Output: 1 (Since 16 = (10000) rightarrow 1 bits is 1) Input: 0 Output: 0 (Since 0 = (0) rightarrow None of the bits is 0) unsigned int calculate Hamming Weight (unsigned int num) { }