Question: 4. Write a C program which simulates a simple guessing game. The program should choose a random number between 1 and 100 as the 'secret'

 4. Write a C program which simulates a simple guessing game.

4. Write a C program which simulates a simple guessing game. The program should choose a random number between 1 and 100 as the 'secret' number before the game begins. The user should then be continually prompted to enter their guess. After each guess is entered, your program should inform the user whether the secret number is higher or lower, or if they guessed correctly. This should continue until they finally get the number right. HINT: To create the random number, use the following code at the beginning of your main function. You will also need to #include and #include at the top of the program int secret_num; srand (time (NULL)) ; secret-num = rand () % 100 + 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!