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
slega [8]
3 years ago
11

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

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

Answer:

The outputs of the code is

2

0

2

Explanation:

First, I'll arrange the code line by line. While arranging the code, I'll make some corrections

#include <iostream>

using namespace std;

void doSomething();

int main(){

int x = 2;

cout << x <<endl;

doSomething(x);

cout << x << endl;

return 0;

}

void doSomething(int &num)

{

num = 0;

cout << num << endl;

}

At line 6, the value of x which is 2 is printed and the line is terminated to prevent printing of value on the same line. So, the next print statement will start on the next line.

At line 7, the function doSomething () is called.

This statement will execute the instructions in the doSomething () function and print value 0. This line is also terminated.

At line 8, the value of x is printed which is also 2

You might be interested in
write an expression taht evaluated to true if and only if the variable s does not contain the string 'end'
natima [27]

Answer:

//check which string is greater

if(strcmp(name1,name2)>0)

//assign name1 to first, if the

    //name1 is greater than name2

    first=name1;

else

    //assign name2 to first, if the

    //name2 is greater than name1

    first=name2;

5)

//compare name1 and name2

    if(strcmp(name1,name2)>0)

   

         //compare name1 and name3

         if(strcmp(name1,name3)>0)

       

             //assign name1 to max, becuase

             //name1 is greater than name2 and name3

             max=name1;

       

Explanation:

7 0
3 years ago
A developer of a relational database refers to a file as a
goldenfox [79]
This is the correct Answer    <span>Attribute</span>
5 0
3 years ago
What is data consolidation?
Katarina [22]
<span>Data consolidation is the gathering and/or integration of data coming from many and diverse  sources and going into a single destination. Meanwhile this process is taking place,  different data sources are consolidated, into a single data store.

Hope this helps.</span>
8 0
4 years ago
20 points
Keith_Richards [23]
If the four colors are well -balanced then nothing could be best scheme other than the "Square" as it is it's characteristic

In short, Your Answer would be Option C

Hope this helps!
7 0
3 years ago
T or F: Is there such thing as an OptiPlex 3020
eduard
T.
I hope this helps!
8 0
3 years ago
Other questions:
  • A flowchart would be an example of what kind of programming?
    12·1 answer
  • What is the simplest way to convert a decimal number in a binar one in c++?
    8·1 answer
  • Name some of the file extensions for images and provide more information about one or two of them.
    12·1 answer
  • How do most database users perform data searches?
    6·1 answer
  • Why are advanced features helpful when businesses use spreadsheets
    5·1 answer
  • Write an application that inputs a telephone number as a string in the form (555) 555-5555. The application should use String me
    10·1 answer
  • To achieve balance—that is, to operate an information system that satisfies the user and the security professional—the security
    13·1 answer
  • NAT addresses concerns over the dwindling IPv4 address space by ___________________. 1 point allowing networks to use fewer IP a
    15·1 answer
  • Which of these would be the fastest transition duration?
    6·2 answers
  • Mille gets a text from her friend asking if she wants to come over. It seems like a bit of a hassle to go to her friend's house,
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!