Ask Question
3 August, 08:59

What will the following code display?

int number = 6;

cout << + +number << endl;

1. 0

2. 5

3. 7

4. 6

+2
Answers (1)
  1. 3 August, 10:07
    0
    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What will the following code display? int number = 6; cout ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers