Assignment 9:
Instructions
This assignment will have you creating a program to play an old game, the guessing game. The program will need to generate a random number between 1 and 100 and asks the user to guess what the number is. The program will determine if the users guess is higher than the random number, notifying them with Too high, try again. If the users guess is lower than the random number, the program should display Too low, try again.
The user will have only 10 guesses to get the random number, it will use a loop that repeats until the user correctly guesses the random number or has made 10 guesses. The program needs to keep track of the number of guesses the user makes.
When the game ends, it will display one of the messages in the table below based on the number of guesses the user took.
The users guesses must be validated by making sure the value entered is between 1 and 100. If the value is not between 1 and 100, the user should be told to make another guess. The invalid input should not count as one of the 10 guesses the user is allowed. Pseudocode must be provided in the comment block at the top of the file.
Number of Guesses by the User
Output Message
Less
than 5 guesses
Either you know the secret or you got lucky!
5-7 guesses
Youre pretty good at this!
8-10 guesses
Youll do better next time.
If guess 10 is not correct
Sorry You have taken too many guesses.
Assignment 10:
The input for this program will come from a file that you will need to create. The file you create will be called Random.txt. The file should contain a list of random numbers (you pick the values) with each number on a different line within the file, use a text editor to create the file.
The program will open the file and reads all of the numbers from the file and calculates or determines the following:
Counts how many numbers were read from the file
Determine the lowest and highest values in the file
The average of all the numbers in the file
The sum of all the numbers in the file (a running total)
The program must validate that the file was opened before reading from the file. If not then provide a message to the user and then the program should end.
Pseudocode must be provided in the comment block at the top of the file.
E Book: Gaddis, Tony. (2018). Starting Out with C++: From Control Structures Through Objects (9th). Hoboken, NJ: Pearson. eText