I have a structure containing

struct XboxFriends
{
	char gamertag[SIZE];
	char name[SIZE];
	char country[SIZE];
	char city[SIZE];
	char favoriteGames[SIZE];
	int age;
};

this code is supposed to keep track of my xbox friends. I also have written a function

void searchFriends(vector<XboxFriends> &friends)
{
	string gameName;
	cout << "--- Favorite Game Search ---\n\n";
	cout << "Search Keyword: ";
	cin.ignore();
	getline(cin, gameName);
	
		for(unsigned int i=0; i<friends.size(); i++)
	{
		if (gameName == friends[i].favoriteGames)
			cout << friends[i].gamertag << endl;			
	}
	cout << endl;
	cout << endl;
}

This code is supposed to search through my friends favorite games and if they match they return the gamertag name. I realize that right now my code is just comparing the input to the whole string and returning the gamertags of those that match. I was just wondering if anyone could give me some advice on how to search the string for just keywords and still return the gamertags of those that match?

This question has already been answered. Start a new discussion instead.