← Back to STL Containers
Question 544
Weekly Temperature Report
Weekly Temperature Report
Anarray<double, 7>namedtempsholds one temperature per day of the week: {24.5, 26.0, 31.5, 22.0, 28.0, 25.5, 27.3}. Find the highest value, the lowest value and the average (sum divided by 7), then print three lines labelled High, Low and Average, as shown in Expected Output. Print every number with exactly one decimal place usingfixedandsetprecision(1)from<iomanip>.
Expected Output:
High: 31.5 Low: 22.0 Average: 26.4
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
STL Containersstd::array
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.