This isn't returning any answer at all when I run it. I can't quite figure out why. Basically I need to multiply each digit of a given number by its base raised to the degree equal to the number of digits. the power decrements each time it runs. Or it should, anyway. It doesnt.
int num, sum, base;
sum = 0;
cout << "num";
cin >> num;
cout << "base";
cin >> base;
int power = 0;
while (num > 0)
{
power++;
num = num/10;
}
return power;
sum = 0 ;
while (num > 0);
{
sum = (num%10)*(pow(base, power));
num = num/10;
power--;
}
sum += sum;
cout << sum;