Hello can anyone help me figure out this C++ programs I don't understand how to do it can anyone program it for me and use comments?
Static arrays or static matrices must be used for this assignment; that is
memory for the matrix must be allocated at compile time; solutions that do not use static
allocation are unacceptable.
Write a program to add two large integers with up to 300 digits. One approach is to treat
each number as a list, each of whose elements is a block of digits of that number. For
example, the integer 179,534,672,198 might be stored with block[O] =198, block[l] =672,
block[2] = 534, block[3] = 179. Then add two integers (lists), element by element, carrying
from one element to the next when necessary
The 'easy' way is to use the approach of having 2 arrays of 300 elements - with each digit stored in an element. Then a simple addition iteration over the arrays.
You first need a function that accepts an integer of up to 300 digits, check that it's valid and convert this into an array with each digit per element.
You need a carry variable - init to 0. Starting from the least significant digit of the input arrays, add the two digits and the carry. The result digit is this sum mod 10. The carry is this sum div 10 (integer in both cases). Store result in the result array. Then do the next digit et al. When finished, display the carry if not 0 and then display the result array starting from the most significant digit - ignoring 0 until a non-0 is displayed.