Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Practice with some cout statements. Assume that the integer object sum contains

ID: 3663731 • Letter: P

Question

Practice with some cout statements. Assume that the integer object sum contains the value 150 and that the double object average contains the value 12.368 and that the header files iomanip and iostream have been included. Show the output generated by the following code segments. Assume each is an independent code segment. (3 points)

use c++

   

a) cout << sum << “ “ << average;

What is the output?

b) cout << sum;

cout << average;

What is the output?

c) cout << sum << endl << average;

What is the output?

Explanation / Answer

(a)
Output:
150 12.368
(First 'sum' value will be printed, then a space and then 'average' value)

(b)
Output:
15012.368
(First 'sum' value will be printed, then no space and then 'average' value)

(c)
Output:
150
12.368

(First 'sum' value will be printed, then a line break and then 'average' value)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote