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)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.