Extraction stops for the operator>> for a couple of resons one of which is:
After the function extracts an element ch for which use_facet<ctype<CharType> >( getloc). is( ctype<CharType>::space, ch) is true, in which case the character is put back.
If the function extracts no elements, it calls setstate(ios_base::failbit). In any case, it calls istr.width(0) and returns *this.
when using the cin operator>> to extract data, a newline character is being left in the buffer. so on its next consecutive read with the string class helper function getline(), the fail bit flag is being set and your string is set to an empty status. try suing the following
// use a cin.ignore() after extracting the continue option
cin >> op;
if ( cin.peek()=='\n' )
cin.ignore();
|