Hi! So I have a class called BigInt which stores exceedingly large integers in the form of a char array of digits. For example BigInt b1("123456789") would yield b1 = {'1','2','3',...'9'}. I was trying to incorporate basic arithmetic and as such was overloading their operators. I managed to get + and - mostly working but I am stuck on multiplication.
it works just like it would if you did it by hand.
digit * digit = more digits with "carry".
that is...
9*9 = 1 carry the 8.
this is terribly inefficient though.
you can do the above using 64 bits or more at a time using the built-in multiplier.
lets say you had 5 digit numbers supported on the CPU... then
10000
*
11
=
110000
or
10000 carry the 1 ... you can use the same principles ... see? Its not exact because you can carry more than 1 digit, but the principles work fine, you can carry 100 same as carrying a 1...
you look like you are on the right track for the 1 digit at a time approach ... if you wanted to explain what its doing wrong? It looks close, but its easier to look at the example of the bug alongside the code.