I want to handle Big Integer (greater than 2^63) in C++. I know that, I need to use string to perform it. But I have no idea about how to write a program which can handle a big integer. Can anyone please help me about handling big integer?
I know how to handle big number addition, subtraction, multiplication and division. But I am frustrate to handle just only one big number with a size up to 2^63. I understand that 1st I need to declare a string variable, than work with the size of the variable. I need to convert the string variable value into integer and finally save the results of my desire work in a string variable. But how can I convert the value of a string into integer (no need to use atoi() function)? How can I convert the results of my work from integer to string?
The main body of the code is written in C, but that really makes no difference, as there's a C++ interface.
To use it you do have to download the source and build the library. Once that's done (a one-off task) you simply include one header file in your program, and add the lib to the linker files.
I'm not claiming this is the best, merely that I've used it and it works well.
This library can handle integers or floating-point values, as well as having many standard mathematical functions (sin, log etc).
But how can I convert the value of a string into integer (no need to use atoi() function)?
Don't. You already said that you cannot store the value as an integer, so converting it to an int would be pointless.
Work on them one digit at a time, and convert each letter to a number as you work on it, and then convert it back again to a letter for the answer string after the calculation is done.
To convert a single char to a number, subtract 48. To convert a single digit number to a char, add 48.