#include#include using namespace std; using namespace BigInt; int main() { // initialization of two BigInt objects BigInt::BigUInt x("123456789012345678901234567890"); BigInt::BigUInt y("987654321098765432109876543210"); // addition of two BigInt objects BigInt::BigUInt result = x + y; // printing the result cout << "The sum of x and y is: " << result << endl; return 0; }
#includeIn this example, we create a BigInt object n with a large integer value of 100, and then compute its factorial using a recursive function. The resulting BigInt object is stored in another BigUInt variable called result and printed to the console. The cppBigInt library is a package library that can be installed using a package manager like vcpkg or included manually by downloading the source code and including it in your project.#include using namespace std; using namespace BigInt; // function to calculate factorial of a BigInt integer BigUInt factorial(BigUInt n) { if (n == 0 || n == 1) return 1; else return n * factorial(n - 1); } int main() { // initialization of a BigInt object BigInt::BigUInt n("100"); // calculating factorial of n BigInt::BigUInt result = factorial(n); // printing the result cout << "The factorial of " << n << " is: " << result << endl; return 0; }