For this program, I keep getting a blank /****************************************************************************** Basic Template for our C++ Programs. *******************************************************************************/ #include
Question:
For this program, I keep getting a blank /****************************************************************************** Basic Template for our C++ Programs. *******************************************************************************/ #include
int main() { int linearSearch(int[], int, int); int lotSize; const int Size = 5; int lotNumber[lotSize] = {45633, 78344, 34522, 66666, 90234}; int lotNumWinner; //holding the winner number int userInputLotNumber; cout << "Welcome to Lottery"; cout << " Enter your lottery number"; cin >> userInputLotNumber; //inputting for user lottery number lotNumWinner = linearSearch(lotNumber, lotSize, lotNumWinner); //if the winning number is found if (lotNumWinner == -1) cout << "You are the winner! "; else { //otherwise the user lost cout << "The lottery number don't match"; cout << "You lost the lottery"; } return 0; } int linearSearch(int array[], int lotsize, int value) { int index = 0; int position = -1; bool found = false; while (index < lotsize && !found) { if (array[index] == value) { found = true; position = index; } index++; } return position; }
Modern Systems Analysis And Design
ISBN: 9780134204925
8th Edition
Authors: Joseph Valacich, Joey George