Sa se scrie un program tcare realizeaza trecerea unui numar din baza 10 in baza b, unde b se citeste de la tastatura

#include<iostream.h>
void main()
{
long n,n1,b,aux,nr;
aux=nr=0;
cout<<"n=";cin>>n;
cout<<"b=";cin>>b;
n1=n;
do
{
aux=aux*10+n1%b;
n1=n1/b;
}
while(n1!=0);
cout<<aux<<endl;;
do
{
nr=nr*10+aux%10;
aux=aux/10;
}
while(aux);
cout<<"numarul "<<n<<" in baza "<<b<<" este: "<<nr;
}

{joscommentenable}