Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

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
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education