subject

Write a program for playing a game with the computer. first, generate a random integer in the range of 6 through 9. this will be the computer’s pick. then generate three random integers for the human player. these random integers are in the range of 1 through 10. if any of these three random integers is greater than the computer’s pick, the human player wins the game. otherwise, the human player loses. you must use a for loop to generate these three random integers. in each iteration, generate and display one random integer. if it is larger than the computer’s pick, display "you have won the game" and break out of the loop. if the human player cannot get a random integer larger than computer’s pick after three iterations , display "sorry you have lost the game".

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:30, yudayang2012pa9u8p
Consider the following statements: #include #include class temporary { private: string description; double first; double second; public: temporary(string = "", double = 0.0, double = 0.0); void set(string, double, double); double manipulate(); void get(string& , double& , double& ); void setdescription(string); void setfirst(double); void setsecond(double); }; write the definition of the member function set() so that the instance variables are set according to the parameters. write the definition of the constructor so that it initializes the instance variables using the function set() write the definition of the member function manipulate() that returns a decimal number (double) as follows: if the value of description is "rectangle", it returns first * second if the value of description is "circle" it returns the area of a circle with radius first if the value of description is "cylinder" it returns the volume of a cylinder with radius first and height second. hint: the volume of a cylinder is simply the area of the circle at the base times the height. if the value of description is "sphere" it returns the volume of the sphere with radius first. otherwise it returns -1.0;
Answers: 1
image
Computers and Technology, 23.06.2019 16:30, isaiahhuettnerowgg8d
What is one reason why indoor air pollution has become an increasing problem.
Answers: 1
image
Computers and Technology, 24.06.2019 00:40, ndurairajownkpq
What social factors affect your health
Answers: 3
image
Computers and Technology, 24.06.2019 13:30, sweeps8758
Which type of excel chart should be used to track students’ progress on test grades? line column bar pie
Answers: 2
You know the right answer?
Write a program for playing a game with the computer. first, generate a random integer in the range...

Questions in other subjects:

Konu
Mathematics, 05.05.2020 15:31
Konu
Mathematics, 05.05.2020 15:31