Im writing a program for my CS215 Class using vigesimal (base 20) numbers. one of the functions is multiplying 2 user input linked lists. after about 5 hours of trying to figure out how to get these lists to multiply i think i found a solution. The problem is its stored in a double. My question is, is there any way to read this value into a linked list. Also, any recommendations on making this method better would be greatly appreciated.
Why don't you just create the product list in the exact same way you do a multiplication of numbers? It's easier to explain in base 10
145x53
put them in reverse lists
5->4->1 and 3->5
and product=NULL
Start from the second list and multiply it with the first using this procedure:
3*5=15, product=5->1
3*4=12, take the 2, add it to 1, and move 1 to the next, so product=5->(1+2)->1=5->3->1
3*1=3, add it to the last element so product becomes 5->3->4
5*5=25, take the 5, add it to the second element of the list, and the two to the third element so product=5->(3+5)->(4+2)=5->8->6
5*4=20, take the 0, add it to the third element in the list, and 2 to the next element, so product=5->8->6->2
5*1=5, add it to the 4th element in the list, so the product becomes 5->8->6->7, which now you need to reverse
First and foremost i want to thank you for commenting, Ive done more work since i posted this and Ive got it multiplying by single digits just fine. when multiplying by multiple digits i cant seem to comprehend how to incorporate the 0 that gets added in.