that should work and stop after valid number was found. You can change condition to search entire array by removing boolean flag, . Its a simple program and should be able to do it yourself .
Code:
#include <iostream>
using namespace std;
void searchlist (double [],int,double);
const int index = 18;
int main()
{
double num;
double Account[index]=
{5658845, 4520125, 7895122, 8777541, 8451277, 1302850,
8080152, 4562555, 5552012, 5050552, 7825877, 1250255,
1005231, 6545231, 3852085, 7576651, 7881200, 4581002 };
cout << "enter Number\n";
cin >> num;
searchlist(Account,index,num);
system("pause");
return 0;
}
void searchlist(double list [index],int index,double value)
{
bool found=false;
int i=0;
while (i<=index && !found)
{
if (list [i] == value)
{
cout<<"Valid"<<endl;
found=true;
}
else
cout<<"Invalid"<<endl;
i++;
}
}