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
Lady_Fox [76]
3 years ago
9

What will the following code display? #include using namespace std; void doSomething(int); int main() { int x{2}; cout <<

x << '\n'; doSomething(x); cout << x << '\n'; return 0; } void doSomething(int num) { num = 0; cout << num << '\n';
Computers and Technology
1 answer:
Leno4ka [110]3 years ago
8 0

Answer:

The code will display the following on the screen:-

2

0

2

Explanation:

The output is like this because x{2} assigns the value 2 to the integer x.First the value of x is printed on the screen that is 2 and that newline is used to go to the next line.After that function is called doSomething with x passed as the argument. doSomething function assigns the value zero to the variable passed and prints it on the screen.So the next line is 0.Since x is passed by value so no changes will appear in the original argument.Hence the last line printed is 2.

You might be interested in
A laptop has an Nvme drive (C:) and a mechanical hard drive (D:), when the user notice that the D: drive is not there.
Ghella [55]

Answer:

Explanation:

The user should type in the search bar at the bottom right of the taskbar the following keywords, Create and format hard disk partitions and click on the option that appears with the same name. This will open Disk Management which will give information on all of the different storage options that the computer has installed. If the OS is detecting and recognizing the drive it will appear here. Many times the drive does not appear because it does not have a drive letter assigned to it. This can be assigned to the drive from the Disk Management.

6 0
3 years ago
NEED HELP AGAIN
Anestetic [448]
The answer to the question is D)
8 0
3 years ago
Read 2 more answers
What is microsoft certification?
BabaBlast [244]
Microsoft certification is a series of programs that provide certification of competence in Microsoft products.
6 0
3 years ago
The process of engineering design typically starts with what ?
klemol [59]

The process of engineering typically starts with brainstorming.
6 0
3 years ago
Write a method named rotateright that accepts an array of integers as a parameter and rotates the values in the array to the rig
trasher [3.6K]
You should really state what language you are using. I have produced your method in C#, and should be easily translatable in to any other language.

static void RotateRight<T>(T[] arr)
{          
    T temp = arr[arr.Length - 1];
   
    for (int i = arr.Length - 1; i >= 0; i--)
    {               
        if (i == 0)                   
            arr[i] = temp;               
        else                   
            arr[i] = arr[i - 1];           
    }       
}
3 0
3 years ago
Other questions:
  • Which part of an I-statement involves a description of your needs or feelings?
    12·1 answer
  • Can I recover my data from HDD if I just started formatting but did not finish it? (I ceased it!)
    7·1 answer
  • ______________is a collection of technologies for abstracting the details of how applications, storage, network, and other compu
    6·1 answer
  • Because public key encryption requires the use of two different keys, it is also known as _____ encryption
    13·1 answer
  • As the project manager for a software development project, you are helping to develop the project schedule. You decide that writ
    13·1 answer
  • Adding software to a digital device, or adding hardware components to a digital device is called _____ .
    13·1 answer
  • Review the section from your textbook related to management information systems (MIS) infrastructures. Determine where each item
    13·1 answer
  • Why operating system is important software for a computer give five reasons
    13·1 answer
  • How to delete Brainly account ?​
    12·1 answer
  • Choose the correct term to complete the sentence.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!