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

PLEASE HELP ASAP!!! CORRECT ANSWER ONLY PLEASE!!! A florist sold 15 arrangements in its first month of business. The number of arrangements sold doubled each m
m∠1 = _° What is the measure of angle one? Picture is provided below Please help 35 50 65
create a model to represent the following percents. 90% 0.9% 900% 9/10%
All queries have a locale, true or false?
Which statement conveys an idea of John Locke's that influenced both the American and the French Revolutions?
In fractions how do you subtract three two from five sixths
During ww2, the battle of midway was significant because
The mass of an Erlenmeyer flask is 85.135 g. After 10.00 mL of water is added to the flask, the mass of the flask and the water is 95.023 g. Calculate the densi
I’m giving the brainliest Which equation can you use to find the value of x
Which option best completes the diagram