I'm trying to do an exercise on vectors, and iterators. I tried searching on google but not much luck into my specific problem.
"Write a program using vectors and iterators that allows a user to maintain a list of his or her favorite games. The program should allow the user to list all game titles, add a game title, and remove a game title."
When I enter in y or Y it starts the loop over, but skips over my getline statement. Is it something still being stored in the input buffer? If so, how do I rectify that, and where is the source of the problem?
Here's the code so far:
using namespace std;
char AGAIN = 'y';
cout << "\tWelcome to the favorite video game program!" << endl;
cout << "\tThis program stores your video game into what's called a vector\n\tand shows what you've entered in so far!" << endl;
cout << endl;
while ((AGAIN == 'y') || (AGAIN == 'Y'))
cout << "\n\nEnter one of your favorite video games!\n";
cout << "So far, you've entered:\n";
for (i = GAME_TITLE_VECTOR.begin(); i != GAME_TITLE_VECTOR.end(); ++i)
cout << *i << endl;
cout << "\nWould you like to enter another title? ";
cin >> AGAIN;