#include <iostream.h>
void displayBits(unsigned x)
{
unsigned m,i=1<<15;
for(m=1; m<=16; m++)
{
cout<<(x & i ? '1':'0');
x<<=1;
if(m%8==0)
cout<<' ';
}
cout<<endl;
}
void main()
{
unsigned x;
cout<<"Enter an unsigned integer: ";
cin>>x;
displayBits(x);
cout<<sizeof(unsigned);
}
void displayBits(unsigned x)
{
unsigned m,i=1<<15;
for(m=1; m<=16; m++)
{
cout<<(x & i ? '1':'0');
x<<=1;
if(m%8==0)
cout<<' ';
}
cout<<endl;
}
void main()
{
unsigned x;
cout<<"Enter an unsigned integer: ";
cin>>x;
displayBits(x);
cout<<sizeof(unsigned);
}