Earn Higher Grades With Instant Assignment Help.Ask Question!

C Programming
(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. 
....

Attachments:
(5/5)

Related Questions

CSI 1420 Introduction to C Programming & 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 majorconstructs of the C programming language – Fu

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 Assignment To Be Done By Our ExpertsGet A+ Grade Solution Guaranteed

expert
joyComputer science
(4/5)
12 Answers Hire Me
expert
Robert DLaw
(4.8/5)
764 Answers Hire Me
expert
Dr Samuel BarberaStatistics
(5/5)
956 Answers Hire Me
expert
Tutor For YouEconomics
(5/5)
885 Answers Hire Me