Here,a much easier way to convert decimal in to base-2,8,16-
Code:
// this program converts the given decimal number into to the desired bases.
#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
 clrscr();
 int i, a[1], b, n;
 char ch;
 do
 {
  cout<<"Enter the Decimal Number to be converted: \n";
  cin>>n;
...