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
Which of the following software program provides for email communication
olga2289 [7]
If "Outlook" is one of the options then thats the answer.
6 0
4 years ago
Read 2 more answers
The listing of a directory shows certain files with permissions set to rwsr-xr-x. what does this indicate?
marta [7]
<span>"rws" means that the user has permissions to read, write and setuid. "r" means the user can read the file and "w" means that the user can write to the file. "s" stands for "setuid" (set user id) is a permission bit that allows the users to execute a program with the permissions of its owner. The "s" can also mean "setgid" (set group id) is a bit that allows the user to execute a program with the permissions of the group owner.</span>
5 0
4 years ago
How does technology improve productivity at home? (Select all that apply.)
Aliun [14]

Answer:

B, C

Explanation:

?

5 0
3 years ago
Here is the model I’m working on and can’t figure it out this model shows the basic process of making a protein what are the str
kolbaska11 [484]

It  does look like a model

Hope it helps I mean just my opinion.

8 0
3 years ago
Read 2 more answers
Which of the following tasks requires you to use the Tabs option?
Monica [59]
Indenting a paragraph :)
7 0
4 years ago
Other questions:
  • What is are example of an engineered item?
    12·1 answer
  • What tab must you click on to view any previously read messages from instructors in the message center?
    14·2 answers
  • Located toward the right of the status bar and contains buttons for zooming the display in and out
    13·1 answer
  • What do you call an unsolicited email message that masquerades as coming from a legitimate sender, and attempts to get you to di
    11·1 answer
  • Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: If userInput is "That darn c
    5·1 answer
  • Give the algorithm and flowchart for following C code:
    6·1 answer
  • Which is a benefit of using the paste link option?
    15·2 answers
  • A(n) _______ gate provides an output of 1 if either or both inputs are 1.
    14·2 answers
  • For this activity, you will practice being both proactive and reactive to bugs. Both are necessary to get rid of errors in code.
    5·1 answer
  • Explain the different type of shift register counter ​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!