Boolean Search(const int list[],
int item,
int length,
int& index)
{
index = 0;
while (index < length && item != list[index])
index++;
return (index < length);
}
Now, you would use the function in this way:
Previous pageint index; Boolean found = Search(list, 14, 15, index); if (found) cout << "14 was found at index: " << index; else cout << "14 was not found";