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

A line has a slope of and a run = 50. What is the rise?
If two populations are merged, each with different frequencies of an allele at a locus, and random mating occurs immediately, how long will it take to achieve a
Who was the 41st president of the United States?
Solve for y y-1= 5(x + 2)
In which of the following situations must you cross at least two different streams of opposing traffic? A. Changing lanes B. Turning left C. Turning right
A triangle is drawn on the coordinate plane. It is translated 4 units right and 3 units down. Which rule describes the translation?
Which of these statements concerning the American government under the Articles of Confederation is accurate? a.The Articles of Confederation allowed
Which of the following graphs is described by the function given below? y = 2x 2 + 6x + 3
¿Qué frases son falsas sobre Subtiava? Fue la capital de Nicaragua. Es una ciudad grande de indígenas. Es un pueblo con gente amable, en donde todos se conocen.
I Need Help Answer Plz!!!