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, 22.06.2019 11:30
What do character formats do for your document's message? a.set the tone b.provide organization c.provide clarity d.set how texts align with documents
Answers: 2
question
Computers and Technology, 22.06.2019 23:20
How can you tell if someone sent you a text message to your email instead of a email
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
What are three software programs for mobile computing?
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Given a link with a maximum transmission rate of 32.8 mbps. only two computers, x and y, wish to transmit starting at time t = 0 seconds. computer x sends filex (4 mib) and computer y sends filey (244 kib), both starting at time t = 0. statistical multiplexing is used, with details as follows packet payload size = 1000 bytes packet header size = 24 bytes (overhead) ignore processing and queueing delays assume partial packets (packets consisting of less than 1000 bytes of data) are padded so that they are the same size as full packets. assume continuous alternating-packet transmission. computer x gets the transmission medium first. at what time (t = ? ) would filey finish transmitting? give answer in milliseconds, without units, and round to one decimal places (e.g. for an answer of 0.013777 seconds you would enter "13.8" without the quotes)
Answers: 3
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, 06.03.2020 16:08
question
English, 06.03.2020 16:09
Questions on the website: 13722362