bnshelton4690 bnshelton4690
  • 04-07-2019
  • Computers and Technology
contestada

What is the output after the following code executes?

int x=10; if ( ++x > 10 ) {

x = 13;

}

cout << x;

Respuesta :

PhantomWisdom PhantomWisdom
  • 12-07-2019

Answer:

13

Explanation:

First understand the meaning of ++x, it is a pre-increment operator.

it means, it increase the value first than assign to the variable.

For example:

x=10

then after executing  ++x, the value of x is 11.

it increase the value and assign to x.

In the question:

The value of x is 10. After that, program moves to the if condition and check for condition (++x > 10) means (11 > 10) condition true.

then, 13 assign to x.

After that value of x is printed as 13.

Answer Link

Otras preguntas

Graph the pair of lines and use their slopes to determine if they are parallel, perpendicular, or neither.
Given the parent function f(x)= ??? in red, write the equation for the transformed function g(x) in green in terms of f(x) .
What is the fraction for the following decimal expansion? 0.125 A. 1/8 B. 1/4 C. 5/12 D. 1/25
Which of the following is an Expression 1 + 2 = 3 x + 3 = 9 8 = 9 x 5 12 + 9
What place on the earth has the highest air pressure? What is it’s elevation and air pressure?
What is the scientific method!? will do brainliest hurry.
What is the solution of the system of equations shown below? y = -x + 3 y = 4x - 2 A. (0,3) B. (1,2) C. (2,1) D. (0, -2)
what is quadratic inequality
What is the simple subject? * O snow and ice O kids and adults O night Othey
how do you say supercalifragilisticexpialidocious