Question: Lab 9 Guess a Random Number Program CSCI 111 Programming and Algorithms I Due Sunday February 14, 11:59pm on turnin 10 Points NEW CONCEPTS: Successful
Lab 9
Guess a Random Number Program
CSCI 111 Programming and Algorithms I
Due Sunday February 14, 11:59pm on turnin
10 Points
NEW CONCEPTS: Successful completion of this lab incorporates the following new concepts.
Random number generator
char letter;
After reading in a value of type char, the following C++ statement line is needed:
o cin.ignore();
RANDOM NUMBERS: How does the mod operation derive a random number

Assume we have access to a huge large number that represents the number of second since January 1, 1970 (https://www.epochconverter.com/). This value can serve as the value for x. Hence, we can choose a range of random numbers by adjusting the divsor. For this lab, we will refer x as rand()
Task list:
1. Create a source code file named lab9.cpp.
2. Prompt the user if he/she would like to play. The user should enter the single character y or n. Then, store the value in a variable of type char.
3. The game starts by generating a random number between 1-10. Use the following code.
int RandomNumber;
srand ( 99 );
RandomNumber = rand() % 10 + 1;
As discussed in class, normally the srand seed value is set to the current system time (i.e. time(NULL), but to pass the turnin tests, use 99 as the seed value which generates the same random number sequence.
4. The program should then prompt the user to guess the value of the random number. The computer should check the following 3 conditions:
If the user guessed correct, congratulate him/her.
If the user guessed too low, then offer the user a hint to guess a larger value.
If the user guessed too high, then offer the user a hint to guess a smaller value.
5. Once the user guesses the random number, prompt the user if he/she wants to play again.
6. Refer to the expected output listing below.
7. Submit your lab9.cpp file on https://turnin.ecst.csuchico.edu/ and get a successful message.
SAMPLE OUTPUT
/user/faculty/jraigoza/CSCI111/Labs/lab9 $ ./lab9
Would you like to play? (enter y or n)
y
Enter your guess
4
Your guess is greater than the random number.
Enter your guess
2
Your guess is less than the random number.
Enter your guess
3
Congratulations. You guessed correctly.
Would you like to play again? (enter y or n)
n
Thanks for playing. Come back again.
/user/faculty/jraigoza/CSCI111/Labs/lab9 $ ./lab9
Would you like to play? (enter y or n)
y
Enter your guess
3
Congratulations. You guessed correctly.
Would you like to play again? (enter y or n)
y
Enter your guess
4
Your guess is less than the random number.
Enter your guess
5
Congratulations. You guessed correctly.
Would you like to play again? (enter y or n)
n
Thanks for playing. Come back again.
/user/faculty/jraigoza/CSCI111/Labs/lab9 $ ./lab9
Would you like to play? (enter y or n)
n
Thanks for playing. Come back again.
/user/faculty/jraigoza/CSCI111/Labs/lab9 $
GRADING
To achieve a maximum score, students will need to clearly prove that they completed the goal.
Points lost for incompleteness, sloppiness, lateness, or failure to follow instructions.
Refer to syllabus for late policy.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
