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

What will the following code display?

int number = 6;
cout << ++number << endl;




1. 0

2. 5

3. 7

4. 6

Respuesta :

PhantomWisdom PhantomWisdom
  • 18-07-2019

Answer:

7

Explanation:

The operator '++number' is called the pre increment operator which is used to increment the value by 1 first and then assign.

for example:

int n = 10;

b = ++n;

here, it increase the value of 10 first then assign to b. hence, b assign the value 11.

similarly, in the question:

int number = 6;

after that, the pre increment operator increase the value by one and then assign to number.

it means number assign the value 7 and finally print the value.

Therefore, the answer is 7.

Answer Link

Otras preguntas

I need help on (a) I don't know what equation to use?
An equilateral triangle has an altitude length of 18 feet. Determine the length of a side of the triangle
what is the greatest common factor of 14 and 21?
why did the new deal seek to solve the problems of the depression through public works rather than the dole?
Please help me :'( I have been stuck on this
Fill in the blank. Cells, ______, Organs, Organs Systems.
• 60 candy bars and 110 drinks will sell for $265 • 120 candy bars and 90 drinks will sell for $270 How much does each candy bar sell for?
Kyle received his paycheck in the mail today. However, he thinks there is a mistake in the amount he was paid. The total amount before taxes were taken out was
19 is 50% of what number
kai wrote the number 85 on the board is 85 prime or composite?