You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.
The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Debugger - Wikipedia, the free encyclopedia[
^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[
^]
Your code have numerous problems, this line is a memory leak.
node*temp1= new node;
Run your code line by line with the debugger, you will learn a lot.
Advice: Take a sheet of paper and note how is the list on start and how it evolve as you add new nodes, then check if your code match the changes.