I would like to help yah out there mate.. but to be honest I am having a tough time trying to follow ur code..hard with the little bit that you have supplied..plus I do not know what kind of error you are receiving..
EDIT:
hmm... not sure how you are calling the function
SearchIsbn(string InputIsbn)
is this similar to ur code?
Code:
struct BookList
{
string Isbn;
int SearchIsbn(string);
}
int main()
{
BookList* ptrList[20];
}
in order to call SearchIsbn wouldn't u have to type
Code:
ptrList[0]->SearchIsbn("Bob");
?? I believe you would have to pass in one index at a time wouldn't u?
Code:
ptrList->SearchIsbn("Bob") // I don't think this is possible..
I hardy use pointers.. let alone structs so i may be way off... if this were the case then inside ur function definition..
Code:
comparison = InputIsbn.compare( ptrList[index]->Isbn );
would need to be changed to
Code:
comparison = InputIsbn.compare( Isbn );
like i said earlier.. hard to pinpoint ur problem when i have no idea what it is.. how u are calling the function.. what the struct looks like.. etc... this is the best i could come up with..
perhaps this code could be some assistance
Code:
struct BookList
{
string Isbn;
int SearchIsbn(string);
}
int main()
{
BookList* ptrList[20];
ptrList[0]->Isbn = "Hello";
int answer;
for(index = 0; index < 20; index++)
{
answer = ptrList[index]->SearchIsbn("Hello");
if (answer != -1)
break;
}
cout << answer;
return 0;
}
int BookList::SearchIsbn(string InputIsbn)
{
if (InputIsbn.compare( Isbn ) == 0)
{
cout << "The two strings are the same\n";
return index;
}
return -1;
}
this code has not be tested.. just so u know.. i'm too lazy..
ICQ#173580303