//各种进制之间相互转换
//‘d’ 转换为十进制
//‘x’ 转换为十六进制
//‘o’ 转换为八进制
//‘b’ 转换为二进制
// b y :foxhack
//email : [email protected]
//QQ:278563291


#include

void prind_d( int n, char c)
{
   switch(c)
  {
     case 'd':
      {
       if (n<0)
      {
        putchar('-');
        n=-n;
      }
       if(n/10)
        prind_d(n/10,'d');
      putchar(n%10+'0');
       break;
      }
                                 case 'o':
      {
       if(n/8)
        prind_d(n/8,'o');
      putchar(n%8+'0');
       break;
      }
                                 case 'x':
      {
                     char ch[]= "0123456789ABCDEF";
       if(n/16)
        prind_d(n/16,'x');
      putchar(ch[n%16]);
       break;
      }
                                 case 'b':
      {
       if(n/2)
        prind_d(n/2,'b');
      putchar(n%2+'0');
       break;
      }

  }
}


int main( int argc , char *argv[])
{
                 int a;
   char c;
  puts( "please input num:for example 16,d");
                scanf( "%d,%c",&a,&c);
  prind_d(a,c);
  putchar('\n');
   return 0;

}