当我运行它时,这根本没有返回任何答案。我不太明白为什么。基本上我需要将给定数字的每个数字乘以它的基数,提升到等于位数的程度。每次运行时功率都会下降。或者它应该,无论如何。它没有。
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;