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
zhuklara [117]
4 years ago
7

Write a statement that compares the values of score1 and score2 and takes the following actions. When score1 exceeds score2, the

message "player1 wins" is printed to standard out. When score2 exceeds score1, the message "player2 wins" is printed to standard out. In each case, the variables player1Wins, player1Losses, player2Wins, and player2Losses, are incremented when appropriate. Finally, in the event of a tie, the message "tie" is printed and the variable tieCount is incremented.
Computers and Technology
1 answer:
Citrus2011 [14]4 years ago
6 0

Answer:

Following are the statement in the C++ Programming Language.

//check condition that score1 is greater than score2

if (score1 > score2)

{//print the message  and brake line

cout << "player1 wins" << endl;

//increment in the variable by 1

++player1Wins;

//increment in the variable by 1

++player2Losses;

}

//check condition when score2 is greater than score1

else if (score2 > score1)

{ //print the message  and brake line

cout << "player2 wins" << endl;

//increment in the variable by 1

++player2Wins;

//increment in the variable by 1

++player1Losses;

}

//otherwise

else

{ //print the message  and brake line

cout << "tie" << endl;

//increment in the variable by 1

++tieCount;

}

Explanation:

<u>Following are the description of the program</u>.

  • In the statement, we check that the variable 'score1' is greater than 'score2' then, print message and brake line, then increment in the variables by 1 that is 'player1Wins' and 'player2Losses'.
  • Again check that the variable 'score2' is greater than 'score1' then, print message and brake line, then increment in the variables by 1 that is 'player2Wins' and 'player1Losses'.
  • Otherwise, print the following message and break line then, increment in the variable 'tieCount'
You might be interested in
g Q 2 Suppose I need a data structure having the following characteristics: a) must be very space efficient, and b) I have a goo
SIZIF [17.4K]

Explanation:

a.I would choose an advanced data structure like  dispersion tables.

Scatter tables, better known as hash tables, are one of the most frequently used data structures. To get an initial idea, scatter tables make it possible to have a structure that relates a key to a value, such as a dictionary. Internally, the scatter tables are an array. Each of the array positions can contain none, one or more dictionary entries.

It will normally contain a maximum of one, which allows quick access to the elements, avoiding a search in most cases. To know at which position in the array to search or insert a key, a scatter function is used. A scatter function relates each key to an integer value. Two equal keys must have the same dispersion value, also called a hash value, but two different keys can have the same dispersion value, which would cause a collision.

B. If I eliminated the characteristic b, a possible candidate keeping the previous characteristics would be: Balanced binary trees

Balanced binary trees are data structures that store key-data pairs, in an orderly way according to the keys, and allow quick access to the data, given a particular key, and to go through all the elements in order.

They are appropriate for large amounts of information and have less overhead than a scatter table, although the access time is of greater computational complexity.

Although the storage form has a tree structure internally, this is not externalized in the API, making the handling of the data transparent. They are called balanced because, each time they are modified, the branches are rebalanced in such a way that the height of the tree is as low as possible, thus shortening the average time of access to the data.

5 0
3 years ago
When you open a new presentation, a slide with the default ____ layout appears.
arsen [322]
When you open a new presentation, a slide with the default title slide layout appears.
4 0
3 years ago
Looking for new perm duo i'm NAW and ohmost 1000 wins $100 in earnings. Zeal Nubb on FN tracker
Leni [432]
I don’t under stand the question, if you say it clearly i might be able to help:)
8 0
3 years ago
Read 2 more answers
Activities called ___________ involve the microprocessor receiving commands as software carries out tasks and while input arrive
Damm [24]

I guess the answer in the blank is processes.

Activities called processes involve the microprocessor receiving commands as software carries out tasks and while input arrives from the keyboard, mouse, and other devices.

6 0
3 years ago
Which of the following are steps your employer can take to protect you from
lawyer [7]

Answer:

An employer with workers exposed to high temperatures should establish a complete heat illness prevention program. Provide workers with water, rest and shade. Allow new or returning workers to gradually increase workloads and take more frequent breaks as they acclimatize, or build a tolerance for working in the heat.

5 0
3 years ago
Other questions:
  • 642<br> +277<br> What does 642+277
    7·1 answer
  • What's the best way to change the font size of all your notes pages at once?
    6·1 answer
  • How to instal and complie java in windows?
    13·1 answer
  • A(n) __________ can include a computer's full operating system, applications, and system settings, including security and config
    7·1 answer
  • Evaluating how current, credible, and unbiased a source is ensures:
    7·1 answer
  • Write a sequence of statements that finds the first comma in the string line, and assigns to the variable clause the portion of
    13·1 answer
  • Using the Vigenere cipher, does the length of the key matter?
    8·1 answer
  • A __________ is a sequence of characters.
    10·1 answer
  • A folder is a collection of related of data is true or false​
    10·2 answers
  • list three things that can spoil a printer if they are not of the correct specification and explain what damage may be caused​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!