if(bookAuthor[c].find(search,0) < bookAuthor[c].npos){
// displays bookTitle[c] and bookAuthor[c]
I think "bookAuthor[c].find(search,0)" starts looking at the 0th character of the string stored in the cth index of the bookAuthor array for a string that matches the value of search, but I'm not really sure what "< bookAuthor[c].npos)" does. I looked up .npos, but it doesn't make sense to me.
1) That would be better to write as bookAuthor[c].find(search,0) != bookAuthor[c].npos
2) if substring is not found, .find() will returns npos. That condition can be read as "if search substring found"
std::string::npos is a static data member of class std::basic_string or simply std::string. You can specify a static data member using the class name as it is done in the beginning of this sentence or using object name. So this two statements with rare exception are identical
std::string::npos;
and
std:;string s;
s.npos;
std::string::npos is used to signal the situation "beyond the string".
means that object 'search' was found in the string that is it is not beyond the string. Usually with npos instead of object of class std::string the class name is used
if(bookAuthor[c].find(search,0) < std::string::npos){
and it would be better to write