Huge Integers

Pages: 12
We can help solving, but we're not going to make it instead of you.
In short and delightfully (and deservedly) harsh words, chichi, don't be so damn lazy and listen in class next time. You can ask for specific help, you can ask how something in particular is done, but you can't ask us to do it for you. Unless you're willing to pay. I don't have a paypal account, but you can post your credit card details, social security numbers, insurance information, bank details, etc. if you want :)
how i write the functions

char* add( char* A , char* B, char* C )
char* subtract( char* A, char* B, char* C )
how i shlould link them ?
Ok for starters the numbers need to be signed, which means they can be negatives.

so say in the case of add, if we have -5(a) + 6(b) = 1 (c)

So your going to have to have a check for character @ 0, to make sure it's a minus (-) or anything else will be a plus. with addition your going to have to add each element in the array backwards, I mean from the last element. for example:
1
2
3
 637 + 
 539 =
1176

However if we just added each first element we would get something silly like 161, as you can only store the 1 character in each char variable.
So you need to convert each element to int, to do the calculation store in a temporary variable, if number is above 10, then we will have to store the second digit in the char and then divide the number by 10 and add that to the next set of characters.

So in the case of the above calculation 7+9=16, store the 6 in the char, and add the 1 to the next set which is (3+3=6)+1=7, 7 there is not above 10, so we store that and move onto the next...

//----------------------------------------------
What I don't get about the assignment is if you have a 64 digit number that is all 99999's and add that to another 64digit that is all 999's, how do you end up with a 64digit number?

Can anyone speculate on this ? I'm guessing we just say too bad, and cut off the rest of the number.
Topic archived. No new replies allowed.
Pages: 12