//Amari Mosley CSC5 Chapter 8, P. 487, #2

/*******************************************************************************
*
* LINEAR SEARCH LOTTERY WINNERS
* ______________________________________________________________________________
* 
* This program initializes an array with a lottery ticket buyer's 
* 10 lucky 5-digit combinations, lets the player enter this week's 
* winning 5-digit number, and performs a linear search to report 
* whether or not one of the tickets is a winner.
*
*
*_______________________________________________________________________________
*
*
* INPUT
*		winningNumber       : The 5-digit winning number entered by the user
* OUTPUT
*		resultMessage       : Indicates whether the ticket is a winner or not
*
*
*******************************************************************************/
#include <iostream>
using namespace std;
int main ()
{
    // Constants
    const int NUM_TICKETS = 10;
    
    // INPUT
    int winningNumber;
    
    // Initialize Program variables
    int tickets[NUM_TICKETS] = { 13579, 26791, 26792, 33445, 55555,
                                 62483, 77777, 79422, 85647, 93121 };
    bool found = false;
    
    // Get this week's winning 5-digit number from the user
    cout << "Enter this week's 5-digit winning number: ";
    cin >> winningNumber;
    
    // Search the array for the winning number
    for (int index = 0; index < NUM_TICKETS; index++)
    {
        if (tickets[index] == winningNumber)
        {
            found = true;
            break;
        }
    }
    
    // Output Result
    if (found)
    {
        cout << "Congratulations! You have a winning ticket!" << endl;
    }
    else
    {
        cout << "Sorry, none of your tickets are winners this week." << endl;
    }
    
    return 0;
}