1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
musickatia [10]
3 years ago
10

21. Dice Game Write a program that plays a simple dice game between the computer and the user. When the program runs, a loop sho

uld repeat 10 times. Each iteration of the loop should do the following: • Generate a random integer in the range of 1 through 6. This is the value of the computer’s die. • Generate another random integer in the range of 1 through 6. This is the value of the user’s die. • The die with the highest value wins. (In case of a tie, there is no winner for that particular roll of the dice.) As the loop iterates, the program should keep count of the number of times the computer wins, and the number of times that the user wins. After the loop performs all of its iterations, the program should display who was the grand winner, the computer or the user.
Computers and Technology
1 answer:
Brrunno [24]3 years ago
5 0

Answer:

See Explanation Below

Explanation:

// Program is written in C++ programming language

//.. Comments are used for explanatory purposes

// Program starts here

#include<iostream>

#include <stdlib.h>

#include <time.h>

using namespace std;

int main()

{

int computerWins = 0, computerPlay = 0;

int userWins = 0, userPlay = 0;

int tiedGames = 0;

// Computer Play

for (int play = 0; play< 10; play++) {

   computerPlay = rolls();

   userPlay = rolls();  

   // Check who wins

//Clear Screen

System("CLS")

   if (computerPlay == userPlay) {

       tiedGames++;

cout<<"Ties........" + tiedGames;    }

else {

       if (computerPlay> userPlay) {

           computerWins++;

cout<<"Computer...."<< computerWins;

       } else {

           userWins++;

cout<<"User........"<< userWins;

      }

  }

}

return 0;

}

int rolls() {

srand((unsigned)time(0));

return rand() % 6 + 1;

}

You might be interested in
What term defines Internet applications that help people connect with each other through a virtual environment by providing them
andreev551 [17]
D. social networks is your answer
4 0
4 years ago
Describe the third generation of computers​
djverab [1.8K]

Answer:

The period of third generation was from 1965-1971. The computers of third generation used Integrated Circuits (ICs) in place of transistors. A single IC has many transistors, resistors, and capacitors along with the associated circuitry.

The IC was invented by Jack Kilby. This development made computers smaller in size, reliable, and efficient. In this generation remote processing, time-sharing, multiprogramming operating system were used. High-level languages (FORTRAN-II TO IV, COBOL, PASCAL PL/1, BASIC, ALGOL-68 etc.) were used during this generation.

Third Generation

The main features of third generation are −

IC used

More reliable in comparison to previous two generations

Smaller size

Generated less heat

Faster

Lesser maintenance

Costly

AC required

Consumed lesser electricity

Supported high-level language

Some computers of this generation were −

IBM-360 series

Honeywell-6000 series

PDP (Personal Data Processor)

IBM-370/168

TDC-316

3 0
3 years ago
When light hits an opaque object it will be _______________.
nikklg [1K]
None of it passes through. Most of the light is either reflected by the object or absorbed and converted to heat. Materials such as wood, stone, and metals are opaque to visible light.

Good luck
7 0
2 years ago
Brittany is looking to advance in her current career. She is creating a plan to help strengthen and increase her skills. What qu
algol13
What areas do I need to improve
3 0
3 years ago
Plz answer me will mark as brainliest​
Mumz [18]

Answer:

1.Aapplication

2.Three

3.True

<h3>follow me and mark me brainliest </h3>
5 0
3 years ago
Other questions:
  • . Evan is creating a worksheet and needs to copy information in cells A2:A13 into cells B2:B13. Which of the following is the ea
    11·1 answer
  • An OS X backup utility that automatically backs up files to a dedicated drive that is always available when the computer is turn
    6·1 answer
  • An electronic résumé is a plain-looking document. Please select the best answer from the choices provided T F
    14·2 answers
  • Write a python program stored in file extra_credit.py that takes three different inputs from the user where : First Input: The p
    7·1 answer
  • A drink costs 2 dollars. A taco costs 5 dollars. Given the number of each, compute total cost and assign to totalCost. Ex: 2 dri
    11·1 answer
  • Define the term editing​
    14·1 answer
  • What is the name for non-paid active links returned by an Internet search engine in the search results?
    11·1 answer
  • How do professionals address their problems?
    14·2 answers
  • Which ribbon tab is used to locate the Backstage view and to configure the global Outlook options?
    12·2 answers
  • g Write a program that reads a list of words, and a character. The output of the program is every word in the list of words that
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!