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

tokyo is the capital of what country
Tamora just made the last of her monthly payments on her loan. She had been making these payments for the past nine years. The loan had a principal of $10,675 a
please help quickly thank you
Multiply. 1/4 x 32 =
What is the LCD of 2/5 and 1/10 ?
As agriculture became entrenched in the south: A. Southern whites began to doubt the benefits of slavery. B. the South became too dependent on one crop, l
what is 0.000000028 in scientific notation
Find n. 6/9=n/36 n=_____
Which corrects the shift in tense in this sentence? They all like the beach, but none of them swimming in the ocean. A. swum B. swim C. had swimming D.
Which country was a member of the Axis powers during the Second World War? A. Soviet Union B. United States C. Italy D. China