Magic Numbers
Write a C++ program that creates an integer array that will be used to store 50
int elements. Fill the array by generating random numbers in the range from 0
through 99. Make sure no duplicate values are stored. Repeatedly prompt the user
to enter a number in the range from 0 through 99. Create and use a function
named contains that is passed the array, the size of the array, and the user’s
entry. The function named contains will return a value of true if the user’s entry
matches one of the elements in the array or false if it does not.
Use a while loop to validate the user’s entry making sure that they enter a number
in the range from 0 through 99. Keep track of the number of attempts required to
guess a matching number.
Your program will report whether the value entered by the user was contained in
the array or not. Keep prompting the user for values until they enter a value that is
contained in the array. Report on how many attempts it took for the user to enter a
matching number.