logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

you will edit a guessing game program that is already written the computer generates a number between 1 and 20 the user must guess the number.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Instructions
For this assignment, you will edit a guessing game program that is already written. The computer generates a number between 1 and 20. The user must guess the number. Download and run the attached program. Then, familiarize yourself with the code.

5 points: Please add your answers to the following questions as comments in your file:
   1) Please fully explain line 76: srand(seed);
   2) Please fully explain line 77: randomNumber = rand() % 20 + 1;
   3) Please fully explain line 79: while (guessCounter < GUESSES && guess != randomNumber) 
   4) Please fully explain line 82: while ((1 != scanf("%d", &guess)) || guess < 1 || guess > 20) {
   5) Why is it important to include the stdlib.h C library?

5 points: The program is predictable because the user is entering their own seed for rand(). This follows the logic used in r_drive1.c. Change the code so that rand() is seeded with using the current computer time. Follow the logic in the manydice.c program.

5 points: Edit the program so that the user can select the number of tries they are given.

5 points: Edit the program so that the user can select the range for the numbers to be guessed. Make sure you also edit the prompt to the user for entering their guess.

Edit the program so that the score is kept between function calls. Here is an example of the output you should create: 

Assuming that the previous score was Computer: 1, Human: 2...

**********************

Welcome to the guessing game!
I am thinking of a number between 1 and 20.
Enter your guess or press 0 to stop.
10
The number is higher.
Enter your guess or press 0 to stop.
15
The number is higher.
Enter your guess or press 0 to stop.
18

You got it! The number was: 18
The current score is Computer: 1  Human: 3

***************************
1. Guessing Game
2. 
3. 
....

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

800 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

573 Answers

Hire Me
expert
Husnain SaeedComputer science

615 Answers

Hire Me
expert
Atharva PatilComputer science

526 Answers

Hire Me