My professor has working with very large number. We bring them into our project through a file stream (.txt). I get the MATH behind using 3 arrays to add, subtract, and store the sum of the numbers. I get that you can do a "x-'0'" to convert the char to an int. My arrays are to be able to handle up to 26 digits.
The portion of the code I am having a problem with is below. Right now I am just trying to see if my program brings in the number set for n1, and the number set for n2 correctly. This is what the number set looks like in the .txt file:
5
7
36
85
3878563
6426
2222222222222222222222222
7777777777777777777777777
9999999999999999999999999
9999999999999999999999999
4444444444444444444444444
999999999999999
So n1 would get 5
n2 would get 7.
then i would add them to get, divide and mod if i have to for carry over, all that I get how to do.
The first set comes in to my arrays just fine, padded with extra zeros as he wants it to be. But the second set that should be 3 6 and 8 5 is all messed up. It looks like its getting numbers and skipping them somewhere:
-------------------------------------------------------
this set is fine
5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
the second set is blah!
5 3 -38 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 3 7 5 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Press any key to continue . . .
---------------------------------------------------------------
I'm desperate. My code i have so far is below. I'm sure its flawed or has a more efficient way of going about it, but its at my skill level that I can understand, so please consider that in your reply.