Step-by-step explanation:
Question is not well presented:
The search strings in the question are not well formatted.
First thing, I'll arrange the account number in order of 7;
Meaning that the length of each account number is 7
8149420 5333174 3080098 6755963 9526981 4449539 9387197 5104726 2931356 4282637 1750219 6086650 3164838 2419590 4578589 9718904 674994 12545408
Answer:
// This program is written in C++ Programming Language
// Comments are used for explanatory purpose
// Program starts here
#include <iostream>
using namespace std;
// Initialise Function
int ArrayList(int[], int, int);
// Main Method starts at
int main()
{
// The list of account is 18; so, we Initialise an integer Variable to hold this value
const int acctlist = 18;
// Initialise an array to hold the account numbers
int List[acctlist] = { 8149420 5333174 3080098 6755963 9526981 4449539 9387197 5104726 2931356 4282637 1750219 6086650 3164838 2419590 4578589 9718904 674994 12545408
};
// Declare account number and search result Variables of type integer
int accountnumber, Result;
// Prompt user for account number
cout << "Enter a valid account number: ";
cin >> accountnumber;
// Determine if valid or not
Result = ArrayList(List, acctlist, accountnumber);
if(Result == -1){
cout << "Account number " << AcctNum << " is invalid.\\";}
else{
cout << "Account number " << List[Result] << " is valid\\";
}
return 0;
}
// Function starts here
int ArrayList(int list[], int size, int value)
{
int index = 0,
pos = -1;
bool seen = false;
// Check if Account number is seen in list
while (!seen && index < size)
{
if (list[index] == value)
{
seen = true;
}
pos = index;
}
index++