VC++如何总和两个biginteger数字

发布于 2025-02-03 05:33:16 字数 849 浏览 3 评论 0原文

Say I have

static System::Numerics::BigInteger MinimoNumero; int16_t Uno = 1;
static System::Numerics::BigInteger MaximoNumero;
static const std::string            MaximoNumeroString = "91389681247993671255432112333333333333333333333333333333333333333333333333333333333333333333333333333333";
  
MaximoNumero = System::Numerics::BigInteger::Parse(marshal_as<String^>(MaximoNumeroString));
MinimoNumero = System::Numerics::BigInteger::Parse("1");

How can I SUM 1 to MaximoNumero so I want a result as BigInteger as 91389681247993671255432112333333333333333333333333333333333333333333333333333333333333333333333333333334

If I use

System::Numerics::BigInteger NUM = MinimoNumero + MaximoNumero;

then I got error "more than one operator "+" matches these operands.."

Say I have

static System::Numerics::BigInteger MinimoNumero; int16_t Uno = 1;
static System::Numerics::BigInteger MaximoNumero;
static const std::string            MaximoNumeroString = "91389681247993671255432112333333333333333333333333333333333333333333333333333333333333333333333333333333";
  
MaximoNumero = System::Numerics::BigInteger::Parse(marshal_as<String^>(MaximoNumeroString));
MinimoNumero = System::Numerics::BigInteger::Parse("1");

How can I SUM 1 to MaximoNumero so I want a result as BigInteger as 91389681247993671255432112333333333333333333333333333333333333333333333333333333333333333333333333333334

If I use

System::Numerics::BigInteger NUM = MinimoNumero + MaximoNumero;

then I got error "more than one operator "+" matches these operands.."

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尴尬癌患者 2025-02-10 05:33:16

您不能(通常)在biginteger类型上使用普通算术运算符。而是调用biginteger类型的相关成员函数 - 在这种情况下,add函数:

System::Numerics::BigInteger NUM = System::Numerics::BigInteger::Add(MinimoNumero, MaximoNumero);

You can't (generally) use the plain arithmetic operators on the BigInteger type. Instead, call the relevant member function(s) of the BigInteger type – in this case, the Add function:

System::Numerics::BigInteger NUM = System::Numerics::BigInteger::Add(MinimoNumero, MaximoNumero);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文