برنامه اي كه با استفاده از عملگر هاي بيتي عدد دهدهي رو به دودويي تبديل ميكنه
لطفا دوستان نظراتشون رو درباره اين برنامه بنويسن.با تشكر از همگي
کد:
#include <iostream.h>
#include <conio.h>
int main()
{
unsigned int sh,temp,num;
sh=2147483648;
cout<<" *******This program show the binary number in 32 bit(4 byte)*******"<<"\n \n";
cout<<"inter decimal number: ";
cin>>num;
cout<<"The result in 32 bit(4 byte) is: ";
while(sh!=0){
temp=num&sh;
if(temp==0)
cout<<0;
else
cout<<1;
sh=sh >> 1;
}//end of while
getch();
return 0;
}