Something is going wrong in my program, it will run, but when I put in any number or character in for an answer, it says it is a correct lottery number.
My program:
#include <iostream>
#include <string>
using namespace std;
int LinearSearch (int [], int, int);
int main()
{
const int Lottery = 10;
int nums [Lottery] = {13579, 26791, 26792, 33445, 55555, 62483, 77777, 79422, 85647, 93121 };
int UserSelection, location;
double USER;
cout << "Type in the lottery number you have purchased now:\n\n ";
cin >> UserSelection;
location = LinearSearch(nums, Lottery, UserSelection);
if ( location >-1 )
cout << "The number you have entered is a direct match!!\n\n YOU HAVE WON!!!\n\n" << location << endl;
else
cout << "We are sorry but the number you have entered was not found, please play again!\n\n ";
cin >> USER;
return 0;
}
int LinearSearch (int list[], int size, int key)
{
int x;
for (x=0; x < size; x++);
{
if (list [x] == key);
return 0;
}
return -1;
}

