Explain step by step the next c++ source code for the problem shownbelow... The
ID: 3613697 • Letter: E
Question
Explain step by step the next c++ source code for the problem shownbelow...The problem is:
Please write a function “showbits”.
1. The task of showbits is to display the binaryrepresentation of any integer.( Print
binary equivalent of integers)
2. Any division or remainder operator is notallowed.
3. You can use bitwise operator in this problem.
The source code is:
#include <iostream>
using namespace std;
int main()
{int i;
unsigned int num,mask=0x80000000,bit;
cout<<"Enter a number: ";
cin>>num;
cout<<num<<" in binary is: ";
for(i=0;i<32;i++)
{bit=num&mask;
if(bit==0)
cout<<"0";
else
cout<<"1";
mask=mask>>1;
}cout<<endl;
system("pause");
return 0;
}