Sum Recursion function with linked list

So I'm studying and practicing for a placement exam and was given a few example programs. One of the programs had two parts, one is to create a linked list. The second part was to was to add a recursion function to the existing program. Here is my class...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class IntegerList
{
private:

	int length;
	IntListNode * head;

public:
	IntegerList();
	~IntegerList();
	void makeEmpty();
	bool isFull() const;
	int getLength() const;
	void insertItem(int item);
	void deleteItem(int item);
	void addAtPosition(int number, int position);
	void sum(); //this is the part im trying to add
	void printList();

};


I am having trouble writing a recursion function that will add the integers already in the list. I would show what I have so far for my function implementation but I don't even know where to start. Some pseudo code would be cool, but any help is appreciated, thanks.
> void sum();
as a start int sum();


> Some pseudo code would be cool
get some cards from a deck, compute their sum, ¿how did you do it?
you are able to write some pseudo code.
Topic archived. No new replies allowed.