// Andrew Alspaugh CS1A Chapter 7 p. 446 or 447. #13
/******************************************************************************
CONFIRM LOTTERY NUMBERS
______________________________________________________________________________
The program compares two parallel arrays, the first is the randomly generated
lottery numbers and the second is the user inputted numbers. This program
compares both and determines whether the user is the luckiest person alive
or the stupidest person ever for playing the lottery.
All inputs and randomly generated values are 0-9
_____________________________________________________________________________
INPUTS:
SIZE
maxRange
Lottery[]
User[]
OUTPUS:
WINNER
******************************************************************************/
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
//DATA DICTIONARY
const int SIZE = 5;
const int maxRange = 10;
int Lottery[SIZE];
int User[SIZE];
bool WINNER = true;
int count = 0; //While Loop Counter
//INPUT
//Seed Random Numbers
srand(time(0));
//Input Values of Lottery
for(int count = 0; count < SIZE; count++)
{
Lottery[count] = rand() % maxRange;
}
//Input User Values
for (int count = 0; count < SIZE; count++)
{
cout << "Enter Value 0-9: " << endl;
cin >> User[count];
while (User[count] < 0 || User[count] > 9)
{
cout << "INVALID INPUT: Enter A Value Between 0 and 9 " << endl;
cin >> User[count];
}
}
//PROCESS
//Compare Each Element in Parallel Arrays
while (WINNER && count <SIZE)
{
if (Lottery[count] != User[count])
WINNER = false;
count++;
}
//OUTPUT
//Output Lottery Value
cout << "Winning Numbers Are: " << endl;
for (int count = 0; count < SIZE; count++)
{
cout << Lottery[count] << " ";
}
cout << endl;
//Output User Value
cout << "You Entered: " << endl;
for (int count = 0; count < SIZE; count++)
{
cout << User[count] << " ";
}
cout << endl;
//IF WINNER OR LOSER
if (WINNER)
cout << "CONGRADULATIONS YOU ARE THE GRAND PRIZE WINNER" << endl;
else
cout << "HAHA YOU ACTUALLY THOUGHT YOU COULD WIN THE LOTTERY" << endl;
return 0;
}