a problem in the node.... linked list

hi every one i have an assignment about linked list and i have a problem in the nodes i have done every thing the header , the main and the impalemention files
my problem is in the comment
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
#include <iostream>
#include <string>
using namespace std;
class Node
{
private:
	string info;
	Node *next;
public:
	Node(string in);
	void setInfo(string inf);
	string getInfo();
	void setNext(Node *&);
	Node*& getNext();
}
class Clist
{
private:
	Node *firstNode;
public:
	Clist ();
	void insertLast(Node *& );
	Node *& get(int  );
	int getCount();
	
}//this is the header file 

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
#include "header.h"
int main()
{
void printList(Clist& cList)
{
Node* node;
string link;
string output;
cout << endl;
for(int a=0; a < 10; ++a)
	{
		node = cList.get(a);
		if(node != 0)
		{
			if(a == 0)
			link += "\\/----";
			else
			link += "-------";
			output += " " + node->getInfo() + " -- >";
		}
	}
	output += "\n\n";
	cout << link << "|" << endl;
	cout << endl;
	cout << output;
}
Clist cList;
Node *node;
cout << "Circular list started. Size = " <<cList.getCount() << endl;
node = new Node("A");
cList.insertLast(node);
cout << "Added first node." << endl;
printList(cList);
node = new Node("B");
cList.insertLast(node);
cout << "Added second node." << endl;
printList(cList);
node = new Node("C");
cList.insertLast(node);
cout << "Added third node." << endl;
printList(cList);
node = new Node("D");
cList.insertLast(node);
cout << "Added fourth node." << endl;
printList(cList);
cout << "Circular list size = " << cList.getCount() << endl;
return 0;
}//this is the main 

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
#include "header.h"
Node::Node(string s)
{
	info = s;

}
void Node::setInfo(string in)
{
	info = in;
}
string Node::getInfo()
{
	return info;

}
void Node::setNext(Node *& n)
{
	next = n;
}
Node *& Node::getNext()
{
	return next;
}
Clist::Clist()
{
	firstNode=new Node; //here i don't know if it is right in the default 
                          //constructor to make new (the compiler gave me error)
}
void Clist::insertLast(Node*& n)
{
// how could i insert a node in the last just gave me a hint NOT the solution
}
Node *& Clist::get(int )
{
 //please gave me a hint what this function do!! it is get something but what it is
}
int Clist::getCount()
{
//how could i return the count of the nodes and i dont have the identifier count

}//this is the immplemention file 
Topic archived. No new replies allowed.