https://github.com/remaker01/biginteger
一个用C++写的用于学习的Biginteger类
https://github.com/remaker01/biginteger
Last synced: 23 days ago
JSON representation
一个用C++写的用于学习的Biginteger类
- Host: GitHub
- URL: https://github.com/remaker01/biginteger
- Owner: Remaker01
- Created: 2021-11-04T13:37:51.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-20T03:09:02.000Z (almost 3 years ago)
- Last Synced: 2025-03-01T12:26:38.478Z (over 1 year ago)
- Language: C++
- Size: 389 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Github上格式化可能有问题,推荐看docs/zh_cn/html/index.html
## Biginteger
一个用C++写的用于学习的Biginteger类。
本人是中国江苏某三流大学计算机专业的学生,受到Java中BigInteger类的启发,自己用C++ 写了一个大整数类,目前功能还很不完善,只支持加、减、乘、比较大小而且暂不支持负数。
关于具体使用方法,请参见docs/html,这是用doxygen自动生成的帮助文档。
欢迎提出任何有益的意见和建议。
~~为了锻炼英语能力,当初写文档时都是用英文写的,现在早就懒得改了,希望见谅哈~~
-------------------------------------------------------------------------------------------------------------------------------
使用方法举例:
#include <iostream>
#include <string>
using std::cin;
using std::cout;
int main() {
string s1,s2;
cin >> s1 >> s2;
Biginteger b1(s1),b2(s2.c_str());
try {
cout << (b1 + b2).toString() << '\\n';
cout << (b1 - b2).toString() << '\\n';
cout << (b1 * b2).toString() << '\\n';
cout << (b1 / b2).toString() << '\\n';
cout << (b1.absolute() % b2.absolute()).toString() << '\\n';
} catch(NumberFormatException &e) {
cout << e.what();
} catch(DivByZeroException &e) {
cout << e.what();
}
return 0;
}
开发环境:
IDE:CodeBlocks 20.03
编译器:G++(MinGW 8.1.0)
已测试平台:Windows 10 x64,Intel CPU
[临时个人博客地址](https://blog.csdn.net/m0_51303687?spm=1011.2124.3001.5343)
--------------------------------------------------------------------------------------------------------------------------------------------------------
There may be some formatting errors on Github.See docs/en_us/html/index.html
A BigInteger class written in C + + for learning.
I am a computer major student of an ordinary university in Jiangsu, China. Inspired by the BigInteger class in Java, I have written this Biginteger class in C + +.
At present, It is not perfect and only support addition, subtraction, multiplication and comparison.Negative numbers is NOT supported temporarily.
For specific usage, please refer to docs / html, which is a help document automatically generated by Doxygen.
All useful comments and suggestions are welcome.
-------------------------------------------------------------------------------------------------------------------------------
Usage examples: see codes above.
Development Environment:
IDE: CodeBlocks 20.03
Compiler: G + + (MinGW 8.1.0)
Tested platforms: Windows 10 x64, Intel CPU
[Temporary Personal Blog Address](https://blog.csdn.net/m0_51303687?spm=1011.2124.3001.5343)