We are trying to go through a linked list and add all the values together and then return the sum using recursion. Can anyone help us with this please?
1 2 3 4 5 6 7 8 9 10
//Adds the values in the Linked List by recursion
template<class type>
double stack<type> :: sum()
{
node<type> * tmp = new node<type>;
int t = 0;
tmp -> next = head;
t = t + tmp -> data;
tmp -> next = tmp -> next;
}