Sometimes flushing the input buffer is magic. This may or may not be the case in your senario, but try this code.
cin.ignore( cin.rdbuf()->in_avail() );
cin.getline(cin,poemend);
cin.clear();
Essentially wrapping your getline with the ignore code and cin.clear.