Jump to content

[C Lang] BigInteger


WhenKittensATK

Recommended Posts

Updated

 

I still need help with the realloc. Also any ideas on how to make the Compare function more in depth. Currently it only compares the last digit of the array (which is the first, it's reversed in the array) and the length of digits. That can only work for certain conditions. So, I need to figure out a way to compare all the digits in case two numbers have the same last digit and same length. Any suggestions or hints?

 

Ex. 1000 in the array looks like 0001, so it compares the last digit which is the first digit.

 

Changelog (1/26/10)

Fixed typos

Edited Add function

Wrote Subtract and Compare function

Added more comments

Share this post


Link to post
Share on other sites

No go with %d for printf. :(

 

I was able to get the highest number to be subtracted by the lower number with some help. So I'll just leave my compare function the way it is and just not call it :D. He never said we had to use it :D.

 

Now I got a few more hours to figure out how to properly print out the code.

 

INPUT

2

2 9999999999 10000000000

2 10000000000 9999999999

OUTPUT

0-1-1-1-1-1-1-1-1-10 - 9999999999 = 00000000001

0-1-1-1-1-1-1-1-1-10 - 9999999999 = 00000000001

 

I tried replacing the part of the code that adds in the zeros to take over blank spaces of uneven arrays with NULLs instead of zeros, but the leading zeros will still show up.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...