+ 2
Which datatype is to be used for handling values in range 10^18 in c++?
I have tried using Long long int, unsigned long long int But it fails for digits greater than 9
8 Antworten
+ 3
You can use boost library. It can handel values beyond 2^64. For more details please check the link below.
www.geeksforgeeks.org/advanced-c-boost-library/amp/
There is a rule by which you can calculate how many digit a data type can store and the logic is 2^10 = 10^3 (nearly)
i.e as long long int is an 64 bit integer, it can support 18 digit number because 2^64 = 10^18(nearly) by the above rule. If you want to handle more digits, you can go for boost library.
+ 4
~ swim ~ 👏
+ 3
But I think int will work just fine....
+ 2
Thank you
+ 2
~ swim ~ what is c++11 wht 11 denoting .
+ 1
No, int cant handle such large values