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
Which view In a presentation program displays you’re slides in full screen modes ?
VladimirAG [237]
Answer:

Slide show view
5 0
3 years ago
Read 2 more answers
Need help on Assignment 4: Evens and Odds
Sliva [168]

n = int(input("How many numbers do you need to check? "))

even = 0

odd = 0

for x in range(n):

   num = int(input("Enter number: "))

   if num % 2 == 0:

       even += 1

       print(str(num) + " is an even number.")

   else:

       odd += 1

       print(str(num) + " is an odd number.")

print("You entered " + str(even) + " even number(s).")

print("You entered " + str(odd) + " odd number(s).")

This works for me. Best of luck.

8 0
3 years ago
What do I do if my friend wants me to watch a video at my house?
steposvetlana [31]

Have him email the link to you and click on the it.

hope this helps, have a great day!

3 0
3 years ago
Read 2 more answers
In gaming, "rendering" refers to:
jarptica [38.1K]
 The answer to your question is, rendering is<span> the process of generating an image from a 2D or 3D model.</span>
5 0
3 years ago
Read 2 more answers
In Excel, you can sort a table by one or more columns by.
timofeeve [1]
Ushsbcjdiosjdhwjwjif math
8 0
3 years ago
Other questions:
  • What two images did you have to add to the wds server to handle the windows installation?
    7·1 answer
  • Your Economics teacher has asked you to create a chart showing how supply and demand affects the price of gasoline. Which applic
    13·2 answers
  • You have received several trouble tickets from the employees in the warehouse for the stand-alone computers used to control vari
    14·1 answer
  • Read at least three (3) academically reviewed articles on Management Information Systems and complete the following activities:
    5·1 answer
  • 4.2: Roman Numeral Converter
    9·1 answer
  • What are three requirements of information technology a. Accuracyb. _______________________________c. __________________________
    13·1 answer
  • Fatal error: Class 'Drush\Commands\DrushCommands' not found in /Users/amy/testsite/Sites/acquia dev desktop/fresh-install/module
    7·1 answer
  • Which statement will properly start the main() function? def main(): def Main def main# def main[]
    14·2 answers
  • Instructions
    13·1 answer
  • Why is it important for the scrum master to help the team focus on daily and iteration goals\
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!