Ok I have gotten myself started and seem to be COMPLETELY lost from here. I just have no clue as to how to finish this program I've tried but don't know where to go from here. Any suggestions would be greatly appreciated. I am supposed to write a program that
Write a program that lets the user enter a charge account number. The program
should determine if the number is valid by checking for it in the following list:
5658845
8080152
1005231
...
etc.
The list of numbers above should be initialized in a single dimensional array. A
simple linear search should be used to locate the number entered by the user. If
the user enters a number that is in the array, the program should display a
message saying the number is valid. If the user enters a number that is not in
the array, the program should display a message indicating the number is invalid.
And here is the code I have so far:
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
cout << "This program written for CS102 Online.\n";
const int size = 18;
long accounts[size] = { 5658845, 8080152,1005231, 4520125, 4562555, 6545231, 7895122, 5552012,
3852085, 8777541, 5050552, 7576651, 8451277, 7825877, 7881200, 1302850,
1250255, 4581002};
int searchLIst(int [], int, int);
}
{
int results;
//Search the array for charge account
results = searchList(accounts, arrSize, number);
// If searchList returned -1, then charge account was not found.
if (results == -1)
cout << "The number you entered is invailid.\n";
else
{
cout << "The charge account number you entered is valid and found in element "
cout << (results + 1) << " in the array." << endl;
}
return 0;
}
long number;
number = get_number(); // subroutine will ask user for a number
{
system("PAUSE");
return 0;
}