I read in a file into a struct. all is fine, but i want to search for a last name within the struct. I can search for a last name but the problem is in the struct i have 2 same authors like.
when i do a search for Malik i get only the first one.Code:C++ Programming: From Problem Analysis... Malik
C++ Programming: Program Design Including... D. S. Malik
I would like to get both results. heres what i have so far
to searchCode:struct Library {
string Title;
string Author;
};
const int ARRAY_SIZE = 1000;
Library books [ ARRAY_SIZE ];
what can i do to return both?Code:int showBooksByAuthor( int count, string name )
{
for(int i = 0; i < count; i++) {
if( books[i].Author.find(name) == 0)
cout << books[i].Title << " (" << books[i].Author << ")" << endl;
}
sorry about the double post and misspelling