I need to save a very large integer in a variable, after i found that i can use boost::multiprecision::cpp_int i tried to use this in my program, but i'm not getting the proper value when i run the program. My program to test this method is:
Code:
    #include <boost/multiprecision/cpp_int.hpp>
    #include <iostream>
    #include <iomanip>
    #include <vector>
    
    
    void print_factorials()
    {
       using boost::multiprecision::cpp_int;
       cpp_int limit = (cpp_int(1) << 128) - 1;
       std::cout<<limit<<std::endl;
       cpp_int factorial = 100000000000000000000000000u;
       std::cout<<factorial<<std::endl;
    }
    int main() {
       print_factorials();
       return 0;
Its output are:
Code:
    340282366920938463463374607431768211455
    15908979783594147840
with one warning message:
Code:
    warning: integer constant is too large for its type [enabled by default]
        cpp_int factorial = 100000000000000000000000000u;
My real program where i need to use this is like:
Code:
   I1=70; I2=70; I3=70; I4=70; I5=456; I6=456; I7=456; I8=456; I9=456; I10=456; I11=456; I12=456;
    cpp_int key = i12+I12*(i11+I11*(i10+I10*(i9+I9*(i8+I8*(i7+I7*(i6+I6*(i5+I5*(i4+I4*(i3+I3*(i2+I2*i1))))))))))
;
Where i1..i12 are positive integers in from 0 to its corresponding I. eg. i1<=>I1. I am doing this for raw-major order calculation where i have got 13 dimension array and i am calculating the offset value of the given address in that array instead of saving given value in 13 dimension array, cas using 13 dimension array, or map is not practical for me since i also need it to write it in file and read it in another program using boot::serialization.