cin.get() reads the next character from cin. '\n' is the new line character cin.get() != '\n' returns true if the read character is not a new line character while (cin.get() != '\n'); The loop stops when it reads a character that is a new line character.
It skips the rest of the line plainly speaking. When people want to do that we often recommend doing cin.ignore(numeric_limits<streamsize>::max(), '\n');
That will also skip the rest of the line but one important difference is that it also stops if the end of the stream is reached (cin.eof() returns true). Your loop will just continue looping infinitely.