logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

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

expert
Winifred ScottResume writing
(5/5)

733 Answers

Hire Me
expert
Robin BlaiseData mining
(5/5)

535 Answers

Hire Me
expert
Samina KhanFinance
(5/5)

551 Answers

Hire Me
expert
StatAnalytica ExpertTechnical writing
(5/5)

620 Answers

Hire Me
C Programming

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. 
....

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. 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

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme