you can do it like this 2
Code:
void base_genrator(int num)
{
     switch(num){
     case 2:
          binary_base
          codegoeshere
          break;
    case 7:
         hex_base
         codegoeshere;
         break;
    case 9:
         decimal_base;
         codegoeshere;
         break;}
you specify the base in your main program and the write the code in the switch .