Help Multiplying Linked Lists

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
void LList::Multiply(){
        LList d;
        LList e;
        d.ReadBackwards();
        d.ConvertAscii();
        listnode* temp1 = head;
        listnode* temp2 = d.head;


        int product;
        int carry = 0;
	double sum = 0;
	double extra;
	float n = 0.0;
	float i = 0.0;
	while (temp2 != NULL){
		product = temp1 ->data;
		product = product * temp2 -> data;
	        product = product + carry;
		if (product >19){
			carry = product/20;
			product = product % 20; 
		}
		else{
		carry = 0;
		product = product % 20;
		}
		n = n + 1.0;
		temp1 = temp1 -> next;
		extra = product *pow(20,i);

		sum = sum+extra;

			if (temp1 == NULL){
				n = 0;
				i = i + 1.0;
				temp1 = head;
				temp2 = temp2-> next;


			}
		}

	cout << sum << endl; // Sum is where the value is stored
	
	

        Clean();
	Duplicate(e);
        Menu();
	
Topic archived. No new replies allowed.