If this is a question from real code, take a look at the homework object. That will help to limit what is being looked at.
The STL containers (vector, list, etc.) have a push_back method. This does exactly what you expect. It pushes an item to the rear or end of the object's list.