Multiple choice

What will be the output after executing the following statements? cout.width(5); cout <<543;

  1. 5 4 3
  2. 5 4 3
  3. 0 0 5 4 3
  4. 5 4 3 0 0
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The width() function is used to display the output with field size 5 and right justified. Hence, output will b |||||| |---|---|---|---|---| | | | 5| 4| 3|