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
PYTHON --- Toll roads have different fees based on the time of day and on weekends. Write a function calc_toll() that has three
Oduvanchick [21]

The toll program illustrates the use of conditional statements;

As a general rule, conditional statements are used to make decisions

<h3>The toll program</h3>

The toll program written in Python where conditional statements are used to make several decisions is as follows:

def calc_toll(hour, morning, weekend):

   toll_fee = 0

   if weekend == False:

       if morning == True:

           if hour < 7:

               toll_fee+=1.15

           elif hour < 10:

               toll_fee+=2.95

           elif hour <= 12:

               toll_fee+=1.90

       else:

           if hour < 3:

               toll_fee+=1.90

           elif hour < 8:

               toll_fee+=3.95

           elif hour >= 8:

               toll_fee+=1.40

   else:

       if morning == True:

           if hour < 7:

               toll_fee+=1.05

           elif hour <= 12:

               toll_fee+=2.15

       else:

           if hour < 8:

               toll_fee+=2.15

           elif hour >= 8:

               toll_fee+=1.10

   return toll_fee

   

Read more about conditional statements at:

brainly.com/question/24833629

#SPJ1

3 0
2 years ago
_____ consists of computer programs that govern the operation of a computer.
telo118 [61]
Hello <span>Siyujiang8092</span>

Answer: Software<span> consists of computer programs that govern the operation of a computer.

Hope that helps
-Chris</span>
6 0
3 years ago
A timestamp is three numbers: a number of hours, minutes and seconds. Given two timestamps, calculate how many seconds is betwee
Sonja [21]

hhd fyi ou dfi gd sdi bvb s ujj gr TX cfg y CD vi if dnainfo unlocks Toronto Yazidi

7 0
2 years ago
Advanced persistent threat (APT) attackers want to ________. Select one: a. create awareness for their causes b. remain unnotice
Romashka [77]

Answer:

Option b (remain unnoticed so they can continue to steal data) is the right approach.

Explanation:

  • APT seems to be sustained but instead designed to target coordinated attack whereby an attacker achieves network access including a longer length of time impossible to conceive.
  • Usually, APT assaults become targeted at organizations throughout fields including such national security, engineering, as well as the financial services industry, as they make increased-value details.

There are 3 other possibilities not relevant to just the given case. So that the option here was the right one.

6 0
3 years ago
1. How does inertia affect a person who is not wearing a seatbelt during a collision?
Ivenika [448]
They could go flying out the window, getting seriously injured. This could also leave to death.
5 0
3 years ago
Read 2 more answers
Other questions:
  • How often should administrators and network users be required to change their password?
    10·1 answer
  • Which of the following protects against cave-ins? A. All answer choices protect against cave-ins B. Shielding C. Shoring D. Slop
    5·2 answers
  • Orifice tubes are A. coded in American models only. B. coded by number for easy identification. C. similarly but not exactly siz
    12·1 answer
  • In this question, you must create a function in C++ using an external editor. When satisfied with your work, you shall attach it
    10·1 answer
  • When mapping a drive, you can type in the path to the shared folder on the host computer. what is the syntax for the path?
    7·1 answer
  • Kara has been asked to create an employment application form for her company. Which of the following items can she use to make s
    10·1 answer
  • Memememememmemememememememmmeememememe
    15·1 answer
  • Write a Java statement that declares and creates an array of Strings named Breeds. Your array should be large enough to hold the
    11·1 answer
  • Im lonellly whos down to date me
    7·2 answers
  • Do you think it's easier to be mean online than offline? why?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!