So I'm trying to create a fairly simple program that allows a user to modify a list of games. The user can add, remove or simply call an enumeration of the games currently inside the list.
The compiler keeps telling me that there is a problem with my use of the find function. My feeling is that I am not allowed to use it with string vectors. Any ideas what th problem is and how to solve it?
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
int choice;
int location;
string game;
vector<string> games;
vector<string>::const_iterator iter;
cout << "1: List all games.";
cout << "2: Add a new game.";
cout << "3: remove a game.";
cin >> choice;
switch (choice)
{
case 1:
cout << "what is the title of the game you would like to add?\n";
cin >> game;
games.push_back(game);
break;
case 2:
cout << "what is the title of the game you would like to remove?\n";
cin >> game;
games.erase(games.find(game));
break;
case 3:
for (iter = games.begin(); iter != games.end(); iter++)
{
cout << *iter;
}
}
return 0;
}