I am trying to create a program that lets you enter an account number and it tells you it is valid or not based if it is in the list. it needs to be a single-dimensional array . this is what i have so far but it does not work. Anybody have any adivce

#include <cmath>
#include <iostream>
using namespace std;

bool searchList(int [], int, int);
void selectionSort(int [], int);

const int SIZE = 18;

int main()
{
    int accounts[SIZE] = 
        5658845,   4520125,   7895122, 
        8777541,   8451277,   1302850,
        8080152,   4562555,   5552012,
        5050552,   7825877,   1250255,
        1005231,   6545231,   3852085,
        7576651,   7881200,   4581002 };

    int accountNumber;

    selectionSort (accounts, SIZE);

    cout << "\nPlease enter a 7-digit account number";
    cin >> accountNumber;

    if (searchList(accounts, SIZE, accountNumber))
        cout << "The number you entered is valid.\n"
    else
    cout << "The number you entered is invalid." << endl;

    return 0;
}

void selectionSort(int array[], int size)
    {
int startScan, minIndex, minValue;

        for (startScan = 0; startScan < (size - 1); startScan++)
        {
            minIndex = startScan;
            minValue = array[startScan];
            for(int index = startScan +1; index < size; index++)
            {
                if (array[index] < minValue)
                {
                    minValue = array[index];
                    minIndex = index;
                }
            }
            array[minIndex] = array[startScan];
            array[startScan] = minValue
        }
    }
bool searchList(int array[], int numElmes, int value)
    {
        bool found = false;
        int first = 0,
            last = numElmes - 1,
            middle;

        while (!found && first <= last)
        {
            middle = (first + last) / 2;
            if (array[middle] == value)
                found = true;
            else if (array[middle] > value)
                last = middle - 1;
            else
                first = middle + 1;
        }
        return found;
    }



1>------ Build started: Project: Charge Account, Configuration: Debug Win32 ------
1>  Charge Account.cpp
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(13): error C2440: 'initializing' : cannot convert from 'int' to 'int [18]'
1>          There are no conversions to array types, although there are conversions to references or pointers to arrays
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(13): error C2059: syntax error : 'constant'
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(22): error C2065: 'accounts' : undeclared identifier
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(22): error C2365: 'selectionSort' : redefinition; previous definition was 'function'
1>          c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(6) : see declaration of 'selectionSort'
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(22): error C2078: too many initializers
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(24): error C2143: syntax error : missing ';' before '<<'
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(25): error C2143: syntax error : missing ';' before '>>'
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(27): error C2059: syntax error : 'if'
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(32): error C2059: syntax error : 'return'
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(33): error C2059: syntax error : '}'
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(33): error C2143: syntax error : missing ';' before '}'
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(33): error C2059: syntax error : '}'
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(36): error C2143: syntax error : missing ';' before '{'
1>c:\users\harrison\documents\visual studio 2010\projects\charge account\charge account\charge account.cpp(36): error C2447: '{' : missing function header (old-style formal list?)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

You are missing an opening brace in your declaration of accounts

int accounts[SIZE] = [b]{[/b]
5658845, 4520125, 7895122,
8777541, 8451277, 1302850,
8080152, 4562555, 5552012,
5050552, 7825877, 1250255,
1005231, 6545231, 3852085,
7576651, 7881200, 4581002 };
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.