subject

In this warm up project, you are asked to write a c++ program proj1.cpp that lets the user or the computer play a guessing game. the computer randomly picks a number in between 1 and 100, and then for each guess the user or computer makes, the computer informs the user whether the guess was too high or too low. the program should start a new guessing game when the correct number is selected to end this run (see the sample run below).

check this example and see how to use functions time() and rand() to generate the random number by computer.

example of generating and using random numbers:

#include
#include // srand and rand functions
#include // time function
using namespace std;

int main()
{
const int c = 10;

int x;
srand(unsigned(time(; // set different seeds to make sure each run of this program will generate different random numbers
x = ( rand() % c);
cout < < x < < endl;
x = ( rand() % c ); // generate a random integer between 0 and c-1
cout < < x < < endl;
return 0;
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 15:10
What role did women fill during world war ii?
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
Which finger presses the h key on the keyboard? index finger on the left hand pinky finger on the right hand index finger on the right hand thumb on the left hand
Answers: 1
question
Computers and Technology, 23.06.2019 23:30
The keyboard usually has six rows of keys. which of the following is not one of the key group categories? letter keys number keys control keys graphic keys
Answers: 1
question
Computers and Technology, 25.06.2019 00:00
When pasting an existing chart into a word document, you can choose to using the paste options button. a. paste the chart as a picture b. embed the chart c. add the chart while keeping the destination formatting intact d. insert the chart while keeping the source formatting intact
Answers: 1
You know the right answer?
In this warm up project, you are asked to write a c++ program proj1.cpp that lets the user or the co...
Questions
question
Mathematics, 02.03.2020 06:45
question
Mathematics, 02.03.2020 06:52
question
Mathematics, 02.03.2020 06:52
Questions on the website: 13722361