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]
3 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]3 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
Why Is Jarvis Banned For Life? Literally Don't need to be forever!
Ahat [919]

Answer:

he used aimbot in playground (I think) and made videos of it for entertainment and Epic Games just banned him. I agree.. Epic could have banned him for weeks maybe not not for life.

Explanation:

5 0
3 years ago
Which is true about SSH and Telnet?
MaRussiya [10]

Answer:

Data is encrypted on SSH

Explanation:

Telnet and SSH both are the networking protocols. These protocol are used for the security of data. In telnet data is sent over the link without any encryption. That is the reason, in telnet protocol data is less secure.

In SSH (Security Shell) protocol data has been encrypted before transmission. The encryption of data make it more secure between transmitter and receiver.

So the true statement is that, SSH has data encryption.

8 0
3 years ago
Which feature of a social news sharing website distinguishes it from a social bookmarking website
Crank
The privacy feature i think
4 0
3 years ago
Read 2 more answers
Write a program with a main method that asks the user to enter an array of 10 integers. Your main method then calls each of the
Kay [80]

Answer:

The remaining part of the question is given as follows:

printReverse - a void method that reverses the elements of the array and prints out all the elements in one line separated by commas (see sample output below).

getLargest - an int method that returns the largest value in the array.

computeTwice- a method that returns an array of int which contains 2 times of all the numbers in the array (see the sample output below).

Explanation:

// Scanner class is imported to allow the program receive

// user input

import java.util.Scanner;

// Arrays class is imported to allow the program display the array

// in a pretty way

import java.util.Arrays;

//The class definition

public class Solution {

   // main method is defined which signify beginning of program

  // execution

   public static void main(String[ ] args) {

       // an array is initialized with a size of 10

       int[] array =new int[10];

       // Scanner object scan is defined

       Scanner scan =new Scanner(System.in);

       // A loop is initiated to receive 10 user input to fill the array

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

           System.out.print("Please enter number: ");

           array[i]=scan.nextInt();

       }

       

       // A blank line is print

       System.out.println();

       // printReverse method is called with the received array as

      // argument

       printReverse(array);

       // A blank line is print

       System.out.println();

       // The largest number is printed

       System.out.println("The largest number is: " + getLargest(array));

       // computeTwice method is called to display the array after

      // multiplying each element by 2

       computeTwice(array);

       System.out.println( "The values of the computed twice array is: " );

       // Arrays class is used to print the array in form of a string

      // not object

       System.out.println(Arrays.toString(array));

   }

   

   //printReverse method declared with inputArray as parameter.

   // It has no return type

   public static void printReverse(int[] inputArray){

       System.out.print("Here is the arrray in reverse order: ");

       // A loop goes through the array starting from the end

       // and display each element

       for(int i = (inputArray.length - 1); i >= 0; i--){

           if(i == 0){

               // If the last element, do not append comma

               System.out.print(inputArray[i]);

           } else {

               // If not the last element, do append a comma

               System.out.print(inputArray[i] + ", ");

           }

       }

   }

   

   // getLargest method is declared with inputArray as parameter

   //  it compare each element in the array and return the largest

   public static int getLargest(int[] inputArray){

       // The first element is assumed to be the largest before the

      // loop begin

       int max = inputArray[0];

       for(int i = 1; i < inputArray.length; i++){

           if (inputArray[i] > max){

               max = inputArray[i];

           }

       }

       return max;

   }

   

   // computeTwice is declared with inputArray as parameter

   // it loop through the array and multiply each element by 2

   // it then return a modified array

   public static int[] computeTwice(int[] inputArray){

       for(int i = 0; i < inputArray.length; i++){

           inputArray[i] *= 2;

       }

       return inputArray;

   }

}

8 0
3 years ago
How's your day :D I hope its goin well you amazing person :D
Rainbow [258]

Answer:

You are an awesome and amazing person!!

Explanation:

7 0
2 years ago
Read 2 more answers
Other questions:
  • Please answers the questions 1-15
    6·1 answer
  • An indirect effect of an action, be it a cost or benefit, for a third party who did not agree to the action is known as a(n) ___
    8·1 answer
  • A computer hard disk starts from rest, then speeds up with an angular acceleration of 190 rad/s2 until it reaches its final angu
    10·2 answers
  • What is the role of the osi application layer? provides control of all the data flowing between the source and destination devic
    5·1 answer
  • When configuring a vpn server to automatically assign ​ip addresses to remote clients, how many ip addresses are in a single poo
    10·1 answer
  • Your customer, Mykel, is ordering a custom-built computer for his home office and isn’t sure which components should be the high
    12·1 answer
  • Which statement describes how to insert the IF, COUNTIF, or SUM function into a cell?
    11·1 answer
  • What are specific and relevant terms that will help you locate information using an internet search engine?
    10·1 answer
  • Can geico save me 15% or more on car insurance?
    8·2 answers
  • Which type of infrastructure service stores and manages corporate data and provides capabilities for analyzing the data
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!