The program runs but has a logic error how can I fix it?
and I need to finish the header block on the function, but I don't know how to, can anyone help
#include <iostream>
using namespace std;
// Function prototype
bool searchList(long [], int, long);
// Constant for the array size
const int SIZE = 18;
int main()
{
// Array of account numbers
long accounts[SIZE] =
{ 5658845, 4520125, 7895122,
8777541, 8451277, 1302850,
8080152, 4562555, 5552012,
5050552, 7825877, 1250255,
1005231, 6545231, 3852085,
7576651, 7881200, 4581002 };
long accountNumber; // To hold an account number
// Get an account number from the user.
cout << "\nPlease enter a 7-digit account number: ";
cin >> accountNumber;
// Search the array for the number and indicate
// whether it is valid or not.
if (searchList(accounts, SIZE, accountNumber))
cout << "The number you entered is valid.\n";
else
cout << "The number you entered is invalid." << endl;
return 0;
}
bool searchList(long list[], int size, long value)
{
bool found = true; // Flag
int count = 0; // Loop counter
// Step through the array as long as the value
// is not found.
while (!found && count < size)
{
if (list[count] == value)
found = true; // The value is found.
count++;
}
return found;
}