Bueno amig@s ahora les traigo un conversor de sistemas numericos hasta la base 32 de manera recursiva aunque el codigo es algo extenso cumple su funcion.
Captura:
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
#include <math.h>
#include <ctype.h>
#define N 35
using namespace std;
int base10(char snum[N],int i,int a);
int potencia(int x,int y);
void conversion(int num,int base);
int bases3_9(char snum[N],int i,int a,int base);
int main(){
char snum[N];
int base,tam,pos,base2,i=0,x,r=-1,a,b;
cout<<"\nIngrese el numero a convertir: ";cin.getline(snum,N);
cout<<"\nIngrese la base: ";cin>>base;
cout<<"\nIngrese la base a la que la desea convertir: ";cin>>base2;cout<<"\n\n";
cout<<"El numero: "<<snum<<" de base "<<base<<" convertido a base "<<base2<<" es: ";
x=strlen(snum);
if(base<10){
conversion(bases3_9(snum,i,x-1,base),base2);
}else{
conversion(base10(snum,i,x-1),base2);
}
cout<<"\n\n";
system("pause");
return 0;
}
int base10(char snum[N],int i,int a){
int n,m=10;
if(a==-1){
return 0;
}
else{
switch(snum[i]){
case '0':n=0;break;
case '1':n=1;break;
case '2':n=2;break;
case '3':n=3;break;
case '4':n=4;break;
case '5':n=5;break;
case '6':n=6;break;
case '7':n=7;break;
case '8':n=8;break;
case '9':n=9;break;
case 'A':case 'a':n=10;break;
case 'B':case 'b':n=11;break;
case 'C':case 'c':n=12;break;
case 'D':case 'd':n=13;break;
case 'E':case 'e':n=14;break;
case 'F':case 'f':n=15;break;
case 'G':case 'g':n=16;break;
case 'H':case 'h':n=17;break;
case 'I':case 'i':n=18;break;
case 'J':case 'j':n=19;break;
case 'K':case 'k':n=20;break;
case 'L':case 'l':n=21;break;
case 'M':case 'm':n=22;break;
case 'N':case 'n':n=23;break;
case 'O':case 'o':n=24;break;
case 'P':case 'p':n=25;break;
case 'Q':case 'q':n=26;break;
case 'R':case 'r':n=27;break;
case 'S':case 's':n=28;break;
case 'T':case 't':n=29;break;
case 'U':case 'u':n=30;break;
case 'V':case 'v':n=31;break;
case 'W':case 'w':n=32;break;
case 'X':case 'x':n=33;break;
case 'Y':case 'y':n=34;break;
case 'Z':case 'z':n=35;break;
}
return (n*potencia(m,a))+base10(snum,i+1,a-1);
}
}
int potencia(int x,int y){
if(y==0){
return 1;
}
else{
return x*potencia(x,y-1);
}
}
void conversion(int num,int base){
int mod;
if(num<base){
switch(num){
case 10: cout<<"A";break;
case 11: cout<<"B";break;
case 12: cout<<"C";break;
case 13: cout<<"D";break;
case 14: cout<<"E";break;
case 15: cout<<"F";break;
case 16: cout<<"G";break;
case 17: cout<<"H";break;
case 18: cout<<"I";break;
case 19: cout<<"J";break;
case 20: cout<<"K";break;
case 21: cout<<"L";break;
case 22: cout<<"M";break;
case 23: cout<<"N";break;
case 24: cout<<"O";break;
case 25: cout<<"P";break;
case 26: cout<<"Q";break;
case 27: cout<<"R";break;
case 28: cout<<"S";break;
case 29: cout<<"T";break;
case 30: cout<<"U";break;
case 31: cout<<"V";break;
case 32: cout<<"W";break;
case 33: cout<<"X";break;
case 34: cout<<"Y";break;
case 35: cout<<"Z";break;
default: cout<<num%base;
}
}
else{
mod=num%base;
conversion(num/base,base);
switch(mod){
case 10: cout<<"A";break;
case 11: cout<<"B";break;
case 12: cout<<"C";break;
case 13: cout<<"D";break;
case 14: cout<<"E";break;
case 15: cout<<"F";break;
case 16: cout<<"G";break;
case 17: cout<<"H";break;
case 18: cout<<"I";break;
case 19: cout<<"J";break;
case 20: cout<<"K";break;
case 21: cout<<"L";break;
case 22: cout<<"M";break;
case 23: cout<<"N";break;
case 24: cout<<"O";break;
case 25: cout<<"P";break;
case 26: cout<<"Q";break;
case 27: cout<<"R";break;
case 28: cout<<"S";break;
case 29: cout<<"T";break;
case 30: cout<<"U";break;
case 31: cout<<"V";break;
case 32: cout<<"W";break;
case 33: cout<<"X";break;
case 34: cout<<"Y";break;
case 35: cout<<"Z";break;
default:cout<<num%base;
}
}
}
int bases3_9(char snum[N],int i,int a,int base){
int n;
if(a==-1){
return 0;
}
else{
switch(snum[i]){
case '0':n=0;break;
case '1':n=1;break;
case '2':n=2;break;
case '3':n=3;break;
case '4':n=4;break;
case '5':n=5;break;
case '6':n=6;break;
case '7':n=7;break;
case '8':n=8;break;
}
return (n*potencia(base,a))+bases3_9(snum,i+1,a-1,base);
}
}
Puedes descargar todo el proyecto en visual studio 2010 express
aqui