According to documentation of std::cin.ignore(streamsize n = 1, int delim = EOF):
Extracts characters from the input sequence and discards them, until either n characters have been extracted, or one compares equal to delim. http://www.cplusplus.com/reference/istream/istream/ignore/
You are putting abcd\n
onto stdin. Your first ignore(3,'\n')
removes abc
and your get() fetches d
. \n
remains in the buffer.
Then you add efgh\n
to the buffer which now contains \nefgh\n
. Your next ignore() reads either 3 characters or a newline, whatever comes first. Since your newline is first in the buffer, only the newline is ignored.
You probably want to empty the stdin buffer before asking for more input. You can achieve this either by modifying your get() call, or by adding a second ignore() call before asking for more input.