一个在c ++中找到10000的阶乘的程序 [英] A program to find factorial of 10000 in c++

查看:106
本文介绍了一个在c ++中找到10000的阶乘的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法存储超出C ++中所有数据类型范围的值。

如何编程存储10000的阶乘结果

Is there any way to store value which exceeds range of all data types in C++.
How to program to store the result of factorial of 10000

推荐答案

#include <iostream>
#include "bigint.h"
using namespace std;
int main()
{
    int i;
    int n = 69;
    RossiBigInt nfactorial(1);
    for (i = 2; i <= n; i++) {
        RossiBigInt bigi(i);
        nfactorial = nfactorial * bigi;
        cout << i << " factorial = " << nfactorial << endl;
    }
    return 0;
}





对于 bigint 请浏览此链接。 http://groups.google.com/group/sources/msg/496e8d3ae812abbb [ ^ ]



For bigint go through this link. http://groups.google.com/group/sources/msg/496e8d3ae812abbb[^]


你是什么想要使用的是 Big number 类或库。在谷歌搜索找到一个。例如:

https://mattmccutchen.net/bigint/ [ ^ ]
What you want to use is a Big number class or library. Search on google to find one. For example:
https://mattmccutchen.net/bigint/[^]


我一直在使用数字理论库 [ ^ ]用于处理大整数。它适合我的需要。
I have been using the Number Theory Library[^] for dealing with large integers. It worked well for my needs.


这篇关于一个在c ++中找到10000的阶乘的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆