Hi,
I have to implement a class to represent the integer numbers which can be 30 digits long. I though about representing them as a 2 integers of long long, like for example:
Code:
class bn
{
public:
long long a,
b;
};
and then just to read the number from the input as a string, check if it is > 15 digits long, if it is, then transform first 15 digits by atoi() to the 'a' and then the rest of the numbers to the 'b'. But I have the problem with leading zeros with the rest of the strings (for example to number 10^30 - in the 'a' there will be stored 10^15 and in the 'b' 0), I don't know how to deal with them. Of course I can remember in a variable the number of leading zeros but it would be slow. Only thing which I need in them is the fast comparison of big numbers. Can anyone help with solving this problem with a good efficiency ?
--
Regards,
apacz