A good and basic implementation of BigInt class in C++ [closed]

孤街醉人 提交于 2019-11-27 02:12:05

问题


I'm looking for a good and basic BigInt class in C++, I find a lot of implementation but most of the time, it's complex implementation for crypto library...

By basic, I mean BigInt can deal with BigInt, long long and strings with operator overloading. If I had time, I had done myself but I do not have time to create an entire BigInt class.


回答1:


Here's one. I haven't used it, but it doesn't look too complex, and it was the first result when I googled "bigint c++".




回答2:


The simplest library I know of is InfInt. It consists of just one header file. Its usage is fairly simple. Here is a sample code:

InfInt myint1 = "15432154865413186646848435184100510168404641560358";
InfInt myint2 = 156341300544608LL;

myint1 *= --myint2 - 3;
std::cout << myint1 << std::endl;



回答3:


http://sourceforge.net/projects/cpp-bigint/

C++ class BigInt that enables the user to work with arbitrary precision integers.



来源:https://stackoverflow.com/questions/10576314/a-good-and-basic-implementation-of-bigint-class-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!