Is there any method to generate large factorial numbers using C++?

I use the following function for generating factorial numbers:

1
2
3
4
5
6
7
long long factorial(int n)
    {
        if(n==1)
            return 1;
        else
            return (n*factorial(n-1));
    }


But this function can only generate maximum 19 digit numbers.

If I want to generate large factorial numbers for example 365. How should I write the function?
You need arbitrary precision math library (or write ony yourself)
Topic archived. No new replies allowed.