Question: For this program, I keep getting a blank /****************************************************************************** Basic Template for our C++ Programs. *******************************************************************************/ #include /* printf, scanf, puts, NULL */ #include /*

For this program, I keep getting a blank /****************************************************************************** Basic Template for our C++ Programs. *******************************************************************************/ #include /* printf, scanf, puts, NULL */ #include /* srand, rand */ #include /* time */ #include // String managment funtions. #include // For input and output #include // For math functions. #include #include using namespace std; //////////////////////////////////////////////////////////////////////// // y = (rand()% (maxValue-minValue + 1)) + minValue /// //////////////////////////////////////////////////////////////////////// int userInputLotNumber; // Insert your code below this line:

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; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!