Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

overview of the Problem. Forthis problem, you will generate arandom number, make

ID: 3815581 • Letter: O

Question

overview of the Problem. Forthis problem, you will generate arandom number, make a guess until you guess correctly. Each time the statistics will be written to a file, For one set of games you will make a guess until you guess correctly. For the second set you will receive an indication of whether you guess was too high or two low. There will be one file "straight, txt' with one line with each count, and another file hints ixt with one line with each count. After both sets of games are finished, the program will read straight txt and print the number of games, total guesses and average with labels. Then it will read hints,txt and print the same information with a label. Specifics of play. You will use rand to get a number n Then the user types in a guess, if the guess is out of range it is ignored, else if is correct a count of guesses is printed to the screen and a file. Each incorrect guess is printed in the correct postion of a line. If the straight version just the guess is printed. If the hints version the printed number is negative if too low and positive if two high. There will be four constants, you must use these everywhere in your code MAX #define GAMES 8 #define STRAIGHT "straight, txt" #define HINTS "hints, txt" At the top of the file. Screen view for user At the start of striaght games it will print Straight 1 16 (if MAX is set to 16)

Explanation / Answer

Inner loops are defined in this question for just one game, that is, till the player manages to guess the correct number. It is inside a total_no_of_games_to_be_played loop.

Inner loop:

while(x != n)

{

   tries++;

    scanf("%d",&x);

}

tries variable will store the number of tries the user took to make the correct guess.