在c++中获取两个大int,并将它们存储在数组中

Get two big int in c++ and store them in array

本文关键字:数组 存储 int 两个 获取 c++      更新时间:2023-10-16

我想知道是否有一种方法可以像一样+两个大int

562159862489621563489 + 51456235896321475268 

而不将它们放在c++中的字符串中

您可以使用long longunsigned long long之类的类型,但要注意整数溢出,您可以获得的实际最大数字取决于平台。

看看

std::cout << std::numeric_limits<long long>::max() << std::endl;
std::cout << std::numeric_limits<unsigned long long>::max() << std::endl;

如果这还不够,也许值得一看这个