- Lab 2 Write A Program That Asks The User To Guess A Random Number Between 1 And 100 Notes The Program Should Tell Th 1 (57.12 KiB) Viewed 25 times
Lab 2 Write a program that asks the user to guess a random number between 1 and 100. Notes: • The program should tell th
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Lab 2 Write a program that asks the user to guess a random number between 1 and 100. Notes: • The program should tell th
Lab 2 Write a program that asks the user to guess a random number between 1 and 100. Notes: • The program should tell the user if their guess is too high or too low. • The program should continue to allow the user to guess the number until the user guesses the random number. • The program should keep track of how many tries did it take for the user to guess the random number. • Once the user guesses the random number, the program should ask the user if they would like to play again. If the user wants to play another game, then the program should generate a new random number for user to guess. • The program should keep track of how many games did the user play. • To generate a random number in C++, use the following code: // time; #include <time.h> #include <stdlib.h> srand, rand srand (time (NULL)); //initialize random seed num= rand() % 100 + 1; //generates a number between 1. and 100