Your first node contains an uninitialized number. You can fix this by changing the loop to while (cin >> num && num != -999)
You can simplify the building code by using a pointer-to-pointer. Not only does this do away the if statement in the loop, it lets you null-terminate the list just once at the end of building it, even if the list is empty.
To print the list (or any time you have to go through it) I prefer using a for loop. It separates the iteration code from the "do something for each item" code:
What impressed me there was the use of a pointer to a pointer. I have never seen that before.
There is nothing like pointer-to-pointer in my textbook.
Any recommended lesson about pointers to pointers would be appreciated
The pointer-to-pointer trick makes deleting items really easy too.
The "big take away lessons" here are:
1. Textbooks teach to the least common denominator. I think this technique doesn't show up in textbooks because many languages don't have the "address of" operator, which is necessary to do this.
2. Pointers aren't just for dynamic memory. This is one example. Another one was on this forum a year or two ago. I can't find the post, but the questioner needed to do the same operation on variables from a wide range of places (function parameters, class members, local variables etc. He wanted to know if there was a way to avoid doing