The problem "Infinitely Big Integer" is splitted into two subproblems:
You should solve the former, Darray Implementation, first.
You may have practiced the problem Big Integer before. Instead of using traditional int, we store the integer in a char array. However, it still has size limitation because we declare a static array for the class. In this problem, we'll use the Darray in problem 13522 - Infinitely Big Integer: Darray Implementation as the data array in class INT to handle arbitary large numbers as long as the memory of the computer is enough.
The following is the structure of INT.
For simplicity, you only need to implement three functions, <<, >> and +=. The streaming operators are used for cin and cout. The operator += does the same as the traditional operator +=. For instance, A += B, A will be the value of A+B and B remains the same. Note that all the parameters are passed by reference, which is different from the previous problem.
Your function.cpp should contain the implementation of both Darray and INT. If you passed the subproblem 1 first, just copy and paste the Darray. For example:
It is okay if you have problems with the popback
function in subproblem 1 as long as the Darray has basic functionality to pass the test cases, because Darray in INT is fully controlled by you.
The following is an alternative main.cpp to test your code: