can someone help me with this problem? I'm having a hard time with it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class node 
{ 
public: 
int data() 
{
return data_field;  
} 
node* link() 
{
return link_field; 
} 
private: 
int data_field; 
node* link_field 
};





Suppose we are using the node class definition listed above. Your program is using a node* variable called head_ptr to point to the first node of a linked list (or head_ptr == NULL for the empty list). Write a few lines of C++ code that will print all the integers in the list.
Last edited on
You have the same post in another forum :
moreybayo wrote:
http://www.cplusplus.com/forum/general/209202/
Sounds like classic case for using an iterator.
Good luck.
Ben.
Topic archived. No new replies allowed.