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
A mule deer can run 1/4 mile in 25 seconds. Which of the following correctly shows this rate as miles per hour?
sashaice [31]
You would do 1/4 * 2.4, since 25 goes into 60 2.4 times so the answer would be 60 mph
8 1
3 years ago
4. Refer to the following code the answer the remaining questions. loop: load r1, r5, 40 ; r1  data_memory[r5 + 40] add r1, r1,
Anni [7]

Answer:

See explaination

Explanation:

Loop Unrolling

Assembly code

loop:

load r1, r5, 40 //r1 = Mem[r5 + 40]

load r6, r5, 36 //r6 = Mem[r5 + 36]

add r7, r6, r2 //r7 = r6 + r2

store r7, r5, 36 //Mem[r5 + 36] = r7

add r1, r1,r2 //r1 = r1 + r2

store r1, r5, 40 //Mem[r5 + 40] = r1

addi r5, r5, -8 //r5 = r5 -8

bne r5, 0, loop //if(r5 != 0)branch to loop

4 0
4 years ago
Consider a city of 10 square kilometers. A macro-cellular system design divides the city into square cells of 1 square kilometer
victus00 [196]

Answer:

1,000 users

10,000,000 users

Explanation:

Given the following :

Area of city = 10 square kilometers

Each cell = 1 square per kilometer

Number of users each cell can accommodate = 100

Total number of users that can be accommodated in the system :

(Total number of cells in the system * number of users per cell)

(10 sqkm / 1 sqkm) * 100

10 * 100 = 1,000 users

B) If cell size is reduced to 100 square meters

Converting 100 square meters to square km

100 sq meters = 0.0001 sq kilometers

Number of users each cell can accommodate = 100

Total number of users that can be accommodated in the new system :

(Total number of cells in the system * number of users per cell)

(10 sqkm / 0.0001 sqkm) * 100

100,000 * 100 = 10,000,000 users

6 0
4 years ago
How are babys made nnnnnnnnnnnnnnnnn
elena-s [515]
Sex sex
Sex
Sex
Sex
Sex
3 0
3 years ago
Using the Internet, search and discuss why naming conventions are important and why programmers should consistently follow them.
LiRa [457]

Answer:

Answered below

Explanation:

Some variable naming conventions include;

1) Variable should begin with either a letter or an underscore.

2) Variables having multiple words should have the first letter of every word after the first word, capitalized. This is the camelCase style.

3) variables should not be named after any of the inbuilt keywords except on special operations to override the original function of such keyword.

4) variable names are case-sensitive.

The importance of following these conventions is to maintain readability and consistency of code. Failure to follow these conventions may lead to chaotic codes, bugs and inefficient performance.

7 0
3 years ago
Other questions:
  • In Excel, an anchor($) allows you to:
    7·2 answers
  • What happens if you never confirm your facebook account?
    8·1 answer
  • Time Conversion C++: Given a time in -hour AM/PM format, convert it to military (24-hour) time.
    9·1 answer
  • Regular languages are closed under complement. True False
    7·1 answer
  • How would you declare an interface named Sports that has the following (show them in your answer as well): A method called jump
    5·1 answer
  • To which of these options does the style in Word apply? Select three options.
    7·1 answer
  • 8.5 Edhesive Code Practice
    14·1 answer
  • Ideally, Internet of Things (IoT) devices have the ability to:
    14·1 answer
  • If you delete search results, you will a. clear the history on the computer. b. delete files from our computer. c. modify the re
    14·1 answer
  • The current annual interest rate is 5 percent, and you are taking out a 20-year loan with a monthly end-of-month payment. If you
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!