How do I instantiate a huge number?

For example, say I wanted to store two 50 digit numbers in a couple variables, and then store their product in a third variable, how can I go about doing that? I'm not too good at c++ so reading the source files didn't shed any light on how to do such a thing for me. Thanks

Added by: tomek, 2014 III 31, Last modified: 2014 III 31

The product of two 50-decimal digit numbers would have 100 decimal digits, so you need a container which has at least log(10^(50*2); 2) = 333 bits. You can take 6 * 64 bits = 384 bits.

Sample program:

#include <iostream>
#include "ttmath/ttmath.h"

typedef ttmath::Int<TTMATH_BITS(384)> Int;

int main()
{
Int a, b, c;

a = "123456765675675";
b = "6457656756767";
c = a * b;

std::cout << c << std::endl;

// the same but checking carry now
c = a;
int carry = c.Mul(b);

if( !carry )
std::cout << c << std::endl;
else
std::cout << "ops, the container Int is too small" << std::endl;
}