I have an assignment due the following week that requires me to multiply two thousand digit binary numbers. The numbers are read from 2 txt files.
Some of the solutions I tried:
1) Used int
, long int
, and long long int
but none of them can hold a thousand digits
2) Read each text file into an array of 1000 units, then into a smaller array of 100 units, each unit holding 10 digits. Unfortunately, this would mean the multiplication wouldn't work properly. And I can't do something like array1*array2
.
What I haven't tried, mainly because I don't think that would work anyway, is converting the binary number to a decimal number, as the value is still too large to fit in any variation of int
.
Anyone have any ideas on how to deal with this? I can write the rest of the program no problem, but I'm struggling with figuring out a way to do the multiplication. I've even done multiple Google Searches and also checked the "similar topics" suggestions that pop up, but nothing that fits my description specifically. Thanks in advance for any help provided, even just pointers that may lead to the solution. If more details are needed, do let me know and I'll get back to it immediately.