Reputation: 38
How to convert a string variable that consists of maximum 100 char to big int ?
My code:
long long int x;
string s="11111111111111111111111111111111";
x=atoll(s.c_str());
cout<<x;
Upvotes: 1
Views: 84
Reputation: 420
You need to use a bignum library, like GNU MP aka GMP or libcrypto.
Since in a 64-bit environment most compiler use 64 bits for a long long int
, you can't even reach near 100 decimal digits with a long long
.
Upvotes: 1