the secret number guessing game you made in the previous task. The secret numbers must be random (hint, you can simply google "C generate random numbers"). Have more than one level. For example, the secret number for level 1 is a number between 1 and 10, the secret number for level 2 is a number between 1 and 100, the secret number for level 3 is a number between 1 and 1000, etc. The user can be given a fixed number of maximum guesses. For example, for the first level, the user has a maximum of 3 guesses. The user gets an additional 5 guesses for the second level if the user succeeds in guessing the secret number in level 1. Meaning if the user used all guesses, the user has 5 guesses in level 2, but if the user used only 1 out of the 3 guesses in level 1, the user will still have the 2 guesses from level 1 plus the 5 additional guesses for level 2 (therefore total of 7 guesses for level 2). An additional 10 guesses for level 3 will be added if the user makes it that far. Etc. The game ends when the user uses all of the user's guesses without correctly guessing the secret number, or until he succeeds in the last level.
the secret number guessing game you made in the previous task. The secret numbers must be random (hint, you can simply google "C generate random numbers"). Have more than one level. For example, the secret number for level 1 is a number between 1 and 10, the secret number for level 2 is a number between 1 and 100, the secret number for level 3 is a number between 1 and 1000, etc. The user can be given a fixed number of maximum guesses. For example, for the first level, the user has a maximum of 3 guesses. The user gets an additional 5 guesses for the second level if the user succeeds in guessing the secret number in level 1. Meaning if the user used all guesses, the user has 5 guesses in level 2, but if the user used only 1 out of the 3 guesses in level 1, the user will still have the 2 guesses from level 1 plus the 5 additional guesses for level 2 (therefore total of 7 guesses for level 2). An additional 10 guesses for level 3 will be added if the user makes it that far. Etc. The game ends when the user uses all of the user's guesses without correctly guessing the secret number, or until he succeeds in the last level.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Context for question:
The user inputs the secret number, then the computer guesses your secret number by randomly generating numbers. The program should automatically output if the user's secret number is higher or lower than the computer's guess. The computer can then use this information for its next random guess. Although the computer's guesses are random, think of ways to make the computer's guesses intelligent, without the computer using the secret number the user entered (that would be cheating on the part of the computer).
#include
#include
#include
int main()
{
int secretNumber, guess;
printf("Enter Secret Number: ");
scanf("%d", &secretNumber);
do {
guess = (rand() % 100 + 1);
printf("The guess is %d", guess);
if (secretNumber == guess){
printf("\nYour guess is correct. Congratulations!\n");
}else if(secretNumber > guess){
printf("\nYour secret number is higher than the guess number.\n");
}else if(secretNumber < guess){
printf("\nYour secret number is smaller than the guess number.\n");
}
}while (secretNumber != guess);
return 0;
}
Do the following
REQUIRED: Modify the secret number guessing game you made in the previous task. The secret numbers must be random (hint, you can simply google "C generate random numbers"). Have more than one level. For example, the secret number for level 1 is a number between 1 and 10, the secret number for level 2 is a number between 1 and 100, the secret number for level 3 is a number between 1 and 1000, etc. The user can be given a fixed number of maximum guesses. For example, for the first level, the user has a maximum of 3 guesses. The user gets an additional 5 guesses for the second level if the user succeeds in guessing the secret number in level 1. Meaning if the user used all guesses, the user has 5 guesses in level 2, but if the user used only 1 out of the 3 guesses in level 1, the user will still have the 2 guesses from level 1 plus the 5 additional guesses for level 2 (therefore total of 7 guesses for level 2). An
additional 10 guesses for level 3 will be added if the user makes it that far. Etc. The game ends when the user uses all of the user's guesses without correctly guessing the secret number, or until he succeeds in the last level.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education