At line 16, after the cin>>ch; there will be a trailing newline remaining in the input buffer. You can remove it by ignoring characters from the input until a newline is found and discarded.
1 2
cin >> ch;
cin.ignore(1000, '\n');
Note: to use std::string the correct header to include is
#include <string>
It can be confusing because some compilers may include other headers when say the <iostream> is included, so it may appear to work even when the required #include is missing or incorrect.
Edit: see JLBorges version above for a better example.
The 1000 here is just an arbitrary large enough number.
It assumes that a user who types 'y' followed by thousand or more spaces and/or other characters before pressing enter does not deserve any sympathy.