簡體   English   中英

在C ++中將String轉換為BigInteger

[英]Convert String to BigInteger in C++

我正在使用BigInteger庫。 但是,當從字符串轉換為BigInteger時,我會發出錯誤“調用BigInteger(string&)沒有匹配函數”。

一個如何在不調用錯誤的情況下從兩者之間轉換?

這是我的代碼片段:

      #include "BigIntegerLibrary.hh"

      str1=randomStrGen(1);
      str2=randomStrGen(1);

      BigInteger s1 = new BigInteger(str1);
      BigInteger s2 = new BigInteger(str2);

https://mattmccutchen.net/bigint/下載的BigInteger庫,2010.04.30版本

這是將std::string轉換為BigInteger

std::string s("3141592653589793238462643383279");
BigInteger f = stringToBigInteger(s);

請注意,方法stringToBigInteger()BigIntegerUtils.hh聲明。

可以在此處找到該庫的此用法以及其他許多示例用法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM