when i m running this code it is reversing bits properly for 5 or less than 5 number of bits. it is not working properly for more than 5 no. of bits.why it is not working properly and how can i overcome this problem?
cout<<"\n enter ur bit code";
Probably because the maximum value of an int in the C++ implementation that you are using is limited to 5 digits. This would be the case, for example, if the int is a 16-bit integer - INT_MAX would be 32,767.
Check this out by printing out INT_MAX ( header <limits.h> ). see: http://en.wikipedia.org/wiki/Limits.h
If this is the case, you may be able to use a long instead an int to allow more digits - in this case, LONG_MAX would normally be 2,147,483,647 allowing up to ten digits in a long.
You seem to be using an obsolete C++ compiler - it would certainly be non-conforming and you should certainly switch to a more modern compiler. I presume you are using a windows machine, in this case you could download a free good compiler + IDE from hre: http://prdownload.berlios.de/codeblocks/codeblocks-8.02mingw-setup.exe
note: <iostream.h> is a pre-standard C++ header and is not part of standard C++ - use the header <iostream> instead. <conio.h> is not, and has never been a standard C or C++ header.