The program asks the user to provide from 1 to 6, inclusive, numbers between 1 and 59, inclusive, as their lotto numbers. The lotto program will then use the random number generator to provide the same number of numbers in the same range. Check to see how many of the numbers match by comparing the contents of both arrays. If less than the quantity of numbers match, start over with another set of newly-generated random numbers. Keep track of how many sets of numbers (your “lottery drawings”) need to be generated before a perfect match of all the numbers is found.
Her is a list of the function prototypes that should be used in the program:
//Function Prototypes
void initArrays (int a[], int b[], int c);
int getNumberOfPicks (void);
void getUsersNumbers (int a [], int b);
void fillRandomArray (int a[], int b);
bool compareArrays (int a[], int b[], int c);
void printResults (int a[], int b, int c);
This is what I have so far;
int main ()
{
int numLot, i;
cout << "This program simulates a lottery game. Warning: finding matches for" << endl;
cout << "just 3 numbers may require 100's of thousands of lottery drawings!" << endl;
do
{
cout << "\nPlease enter the number of lottery numbers to be played from 1 to 6: ";
cin >> numLot;
if (numLot > 6 || numLot < 1)
{
cout << "Error, number out of range--please enter agian:"<< endl;
}
else
break;
}
while (1);
do
{
cout << "Enter a number: ";
cin >> choices[i];
i++;
}
while(i < numLot);
cin.ignore();//flush input buffer
getchar ();
}