part of the code
string phone_book[11] = {"Becky Warren, 678-1223",
"Joe Looney, 586-0097",
"Geri Palmer, 223-8787",
"Lynn Presnell, 887-1212",
"Holly Gaddis, 223-8878",
"Sam Wiggins, 486-0998",
"Bob Kain, 586-8712",
"Tim Haynes, 586-7676",
"Warren Gaddis, 223-9037",
"Jean James, 678-4939",
"Ron Palmer, 486-2783"};
int x, index;
char lookup[50], *strPtr = NULL;
/********************************** Input / Processing **********************************/
cout << "Phone Book\n";
cout << "enter a name: ";
cin.getline(lookup, 50);
for (index = 0; index < 11; index++)
{
strPtr = strstr(phone_book[index], lookup);
if (strPtr != NULL)
break;
}
if (strPtr == NULL)
{
cout << "no match";
}
else
{
cout << phone_book[index] << endl;
}
gives me an error that 2 overlords cant convert all argument types. This happens only when I use array of string objects. When I modify it to 2 dimensional array f chars then the code above works no problem. Whats the problem and how to fix it?
I'm in the process of transition from c to c++ so go easy on me.