How to store extremely large numbers?

前端 未结 4 953
情书的邮戳
情书的邮戳 2020-11-27 06:26

For example I have a factorial program that needs to save really huge integers that can be 50+ digits long. The absolute maximum primitive data type in C++ is unsigned

4条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 07:05

    If you already have a boost dependency (which many people these days do), you can use the boost multi-precision library. In fact, it already has an example of a factorial program that can support output up to 128 bits, though extending it further is pretty trivial.

提交回复
热议问题