shadowblackhear28081 shadowblackhear28081
  • 14-07-2019
  • Computers and Technology
contestada

What will the following code display?

int number = 6
int x = 0;
x = --number;
cout << x << endl;




1. 7

2. 6

3. 5

4. 0

Respuesta :

PhantomWisdom PhantomWisdom
  • 17-07-2019

Answer:

5

Explanation:

The operator '--number', it is a pre decrement operator which decrement first and then assign. It decrement the value by 1.

initially the number is 6.

x is 0.

then, x = --number;

it decrement the number by 1 first and then assign to x.

so, x assign the value 5.

finally, print the value.

Therefore, the answer is 5.  

Answer Link

Otras preguntas

Tatum wants to use partial products to find 14x39 how do I do this?
A recipe calls for 3.75 cups of flour.What is this amount as a mixed number in simplest form
Number 10 I need help
Which number line represents the solutions to |x+4|=2
43 ones times 3 tens equals how many hundreds
can someone answer this.
What is Parris trying to learn from Abigail? Why is he so intent on getting a truthful response? Cite text evidence to support your answer.
Can someone show me the workings of number 18? The answer is C3H8O but I keep getting C2H6O
35. One expressed power of Congress stated in the Constitution is the power to a. coin money b. create treaties. c. create schools. d. establish prisons.
One month julia collected 8.4 gallons of rainwater. That month she used 5.2 gallons of rainwater to water her garden and 6.5 gallons of rainwater to water flowe