c++ - 无符号大整数计算器
阿神
阿神 2017-04-17 11:57:46
0
2
567

C++编译器自带的四则运算对于数据的范围是有要求,对于位数很高的数据的四则运算就无能为力,例如,12378456179787565453232321218784545121123132121132178767655657与11231548785127851的和。
请用设计一个类完成无符号大整数的四则运算,加减法是必须实现的,乘除法选做。
【】最大的问题就是进位那地方的代码,感觉很乱,确实不会
谢谢各位了

阿神
阿神

闭关修行中......

reply all(2)
Ty80

http://www.boost.org/doc/libs/1_58_0/libs/multiprecision/doc/html/boos...

大家讲道理

The first thing to solve is the storage method of large numbers. The options are: 1). Store as strings; 2). Store as linked lists...

There is a question on Leetcode about adding large numbers stored in linked lists, for reference.
https://leetcode.com/problems/add-two-numbers/

You can find many references in the corresponding discussion:
https://leetcode.com/discuss/questions/oj/add-two-numbers

Promote my answer:
https://github.com/braydenCN/leetcode/blob/master/com/brayden/AddTwoNu...

Subtraction of large numbers, or problems of large numbers stored in strings, can be solved similarly.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!