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
madreJ [45]
3 years ago
7

What is the output of the following program? #include using namespace std; void doSomething(int&); int main() { int x = 2; c

out << x << endl; doSomething(x); cout << x << endl; return 0; } void doSomething(int& num) { num = 0; cout << num << endl; }
Computers and Technology
1 answer:
Whitepunk [10]3 years ago
4 0

Answer:

The output will be as following:-

2

0

0

Explanation:

The function doSomething accepts the argument as reference.So whatever changes are made in the function to the argument the changes will be reflected onto the original arguments.

First the value of x is 2.Hence  2 is printed first.

Then function doSomething is called that changes the value of x from 2 to 0 and then prints it.Hence 0 is printed in the newline.

Then in the main function x is printed again the function changed it's value so 0 is printed.

You might be interested in
When you perform a Google search that uses the word "and" (for example: "Restaurant AND Houston"), which kind of logic are you u
Andrej [43]

Answer:

Ordered pairing because binary has zero coding language in it so if we use ordered pairing then we can use and to combine the words.

8 0
3 years ago
Read 2 more answers
Determine the distance between point (x1, y1) and point (x2, y2), and assign the result to points Distance. The calculation is:
Nadusha1986 [10]

<u>Question:</u>

Snapshot of the question has been attached to this response.

<u>Answer:</u>

<u></u>

import java.util.Scanner;

import java.lang.Math;

public class CoordinateGeometry{

    public static void main(String []args){

       double x1 = 1.0;

       double y1 = 2.0;

       double x2 = 1.0;

       double y2 = 5.0;

       double pointsDistance = 0.0;

       

       //Declare a variable to hold the result of (x2 - x1)²

       double x;

       

       //Solve (x2 - x1)^2 and store result in the variable x

       x = Math.pow(x2 - x1, 2);

       

       //Declare a variable to hold the result of (y2 - y1)²

       double y;

       

       //Solve (y2 - y1)^2 and store result in the variable y

       y = Math.pow(y2 - y1, 2);

       

       //Now pointsDistance = SquareRootOf(x + y)

       pointsDistance = Math.sqrt(x + y);

       

       System.out.println("Points distance: ");

       System.out.println(pointsDistance);

       

       return;

    }

}

<u>Sample Output:</u>

Points distance:  

3.0

<u>Explanation:</u>

The above code has been written in Java and it contains comments explaining important lines of the code. Please go through the comments.

The snapshots of the program and a sample output have been attached to this response.

4 0
4 years ago
Select the correct navigational path to sort data using multiple levels.
gavmur [86]

Answer:

Data, Sort and Filter, Sort.

Explanation:

Just did the test.

5 0
3 years ago
Read 2 more answers
What is the output of the following code?<br> print (12 // 6)
sveta [45]

Answer:

2

  • See here we have //
  • // means floor division in python.
  • It gives us only the integer part not floating or decimal.

So

12//6=2

8 0
3 years ago
In the game of economics, producers look to technological improvements to increase which of the following?
Vaselesa [24]
They're looking to increase productivity 
7 0
3 years ago
Read 2 more answers
Other questions:
  • Instructions: Type the correct answer in the box. Spell the word correctly.
    5·2 answers
  • Which software application should be used to communicate in writing about an upcoming event?
    12·2 answers
  • What dod regulation governs the use of commercial wireless devices within the global information grid?
    13·1 answer
  • Which of these should most likely be included in a wire frame ?
    12·1 answer
  • In which of the following situations will a macro make your work more efficient?
    12·1 answer
  • When would an absolute cell reference be most helpful?
    12·2 answers
  • 2. The internet offers a great source of information; however, how are
    9·1 answer
  • What does l m a o actually mean?
    6·1 answer
  • Answer for 3 and 4 please
    15·2 answers
  • Interactivity and Blank______ are two important capabilities of the Internet in the Blank______ relationship.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!