你需要一个自动生成数字的函数。
boost::multiprecision::cpp_int pow(boost::multiprecision::cpp_int value, boost::multiprecision::cpp_int exponent) {
if(exponent <= 0)
return 1;
else if(exponent == 1)
return value;
else {
if(exponent % 2 == 0) {
return pow(value * value, exponent / 2);
} else {
return value * pow(value, exponent - 1);
}
}
}
int main()
{
boost::multiprecision::cpp_int x = 10;
x *= pow(10, 61);//I believe this is the correct number of 0's from manually counting
std::cout<<x<<std::endl;
return 0;
}
如果增强多精度有一个烤箱
pow
函数(我找不到),用它代替。