Hello everybody. That is my code to show binary a decimal number. It's right when a>=0 but when a<0 that can't work, infinite loop. And I don't know what wrong in this code. Can you help me to solve? Thank so much! void bi(int a) { if(a==0) return; bi(a>>1); cout<<(a & (1)); }
//I have a nother code and it's right in both case. However I want to know what happen with this code. Sorry for my bad English