Make LinkedList in C++ more clean I have been working on a linked list for some while now and started out with this.

Is my code clean? Or is there some way to make it better and more readable? 

The reason for this question is for me to be a better programmer. I would love to get one step further for making more clean code. 

my class:

using namespace std;

class Node
{

public:
    int nX; 
    Node *next;
    //constructor
    Node(){ head = NULL; }          //Initialising head to NULL
    void addValueLeft(int nVal);
    void addValueRight(int nVal);
    void deleteValueLeft();
    void deleteValueRight();
    void printList();
private:
    Node *head;   //a pointer to the first Node
};


my main:

int _tmain(int argc, _TCHAR* argv[])
{
    using namespace std;
    //creating a new object
    Node list;

    list.addValueLeft(5);
    list.addValueLeft(6);
    list.addVaueRight(8);
    list.deleteValueRight();
    list.printList();

    return 0;
}    


my functions:

    void Node::addValueLeft(int nVal)
    {
        Node *newNode = new Node;
        if(!head)
        {
            newNode-&gt;nX = nVal;
            newNode-&gt;next = NULL;
            head = newNode;
        }
        else
        {
            newNode-&gt;nX = nVal;
            newNode-&gt;next = head;
            head = newNode;
        }
    }

    void Node::printList()
    {
        if(!head)       //list is empty - nothing to print
        {
            //cout &lt;&lt; "nothing to print - list empty " &lt;&lt; endl;
        }
        else
        {
            Node *tempNode = new Node;
            tempNode = head;
            while(tempNode)
            {
                cout &lt;&lt; tempNode-&gt; nX &lt;&lt; endl;
                tempNode = tempNode-&gt;next;
            }
        }
    }

    void Node::addValueRight(int nVal)
    {
        Node *tempNode1 = new Node;

        if(!head)                   //List is empty
        {
            tempNode1 -&gt; nX   = nVal;
            tempNode1 -&gt; next = head;
            head = tempNode1;
        }
        else
        {
            tempNode1 = head;
            while(tempNode1 -&gt; next != NULL)        //Go to last Node
            {
                tempNode1 = tempNode1-&gt;next;

            }
            Node *tempNode2 = new Node;         //create temp node
            tempNode2 -&gt; nX = nVal;
            tempNode2 -&gt; next = NULL;
            tempNode1 -&gt; next = tempNode2;   //tempNode1 will be last Node    
    }
    }


    void Node::deleteValueLeft()
    {
        if(!head)       //list is empty - Nothing to Delete
        {
            //cout &lt;&lt; " deleteValueLeft:  Nothing to delete" &lt;&lt; endl;
        }
        else
        {
            head = head-&gt;next;
        }
    }

    void Node::deleteValueRight()
    {
        if(head == NULL)    //Nothing to delete
        {
            //cout &lt;&lt; "Nothing to delete " &lt;&lt; endl;
        }
        else
        {
            Node *tempNode1 = new Node;
            Node *oldNode = new Node;
            tempNode1 = head;
            if(tempNode1-&gt;next == NULL) //only one element
            {
                head = NULL;
            }
            else
            {
                while(tempNode1-&gt;next!=NULL)        //Go to last Node
                {
                    oldNode = tempNode1;
                    tempNode1 = tempNode1-&gt;next;

                }
                oldNode-&gt;next = NULL;
            }
        }

    }
Here's some feedback (not an exhaustive list).

using namespace std;


Please stop doing this. when you add using namespace directives in header files, any file including that header will have potential namespace clashes (which is the problem namespaces are trying to prevent).

class Node
{
public:
    int nX; // (1)
    Node *next; // (2)
    Node(){ head = NULL; }  // (3)


Notes:

The only ways lines (1) and (2) are acceptable, are:


if instances of your class are valid regardless what you place in nX and next.


Client code example:

Node n;
n.nX = 1001; // is this valid?
n.next = n; // is this valid?



if Node class is moved from the global namespace to the private section of another class. That way, the outer class will protect the node's data.


Otherwise, nX and next should be private data, with getters to read the values and setters to validate and set the values.

Line (3) is a bad implementation for a constructor, because it leaves a new instance in a partially-initialized state (it should initialize nX, next and head, explicitly and in this specific order).

Better implementation:

explicit Node(int value = 0): nX(value), next(nullptr), head(nullptr) {}


Note regarding class API design:

You are implementing both a node (for an element of the list) and a list of nodes. You should have two classes instead of one, and the head pointer should be a member of the list, not a node:

class Node {
    int nX; Node* next;
public:
    // ... rest of node interface here
};

class List {
    Node *head;
public:
    List() {}
    const std::size_t size() const;
    void add_value_end(int value);
    // ... rest of interface here
};


Eventually, you should consider using node as an internal structure of the list:

class List {
    class Node { /* same as above */ };
    Node *head;
public:
    // same as above
};