// digitsreversed.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "iostream.h"
#include <cmath>

void ConvertBase (int number, int base, int power);

int main(int argc, char* argv[])
{
   int mynumber;
   int mybase;
   cout<<"type in a number in base 10";
   cin>>mynumber;
   
   cout<<"type in a new base";
   cin>>mybase;

   ConvertBase(mynumber, mybase, 10);




	return 0;
}


void ConvertBase (int number, int base, int power)
{ int exponent, counter;

   exponent = pow(base,power);

   if (power<0)
   { // end recursion
	   cout<<"  in base "<<base<<endl;
   }
   
   else 
   {   counter=0;
	   while (exponent<=number  )
	   {
              number=number-exponent;
			  counter=counter+1;
	   }
	   cout<<counter;
	   ConvertBase(number, base, power-1);
	   
   }
   
}
