I am using the GMP multiple precison package.
I need to input very large integers as strings, for example
will set x to that large integer in quotes (10 gives the base.)Code:mpz_init_set_str(x,"1234567890",10)
I want to be able to have the user enter the value, so I did something like:
but this causes g++ to give the following error:Code:#include <string> #include <gmpxx.h> // GMP string num; std::cin >> num; mpz_init_set_str(x,num,10)
error: cannot convert `std::string' to `const char*' for argument `2' to `int __gmpz_init_set_str(__mpz_struct*, const char*, int)'
Any ideas how to input a data type that will work?
I am using Ubuntu on an AMD64.