Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write in C++ 5. Given a data set with 1000 TemperatureReading objects, summarize the average temperature for each city in the list. There are

Please write in C++

5. Given a data set with 1000 TemperatureReading objects, summarize the average temperature for each city in the list. There are no restrictions on how you solve this problem.

Starter Code:

#include  #include  #include  #include  #include "TemperatureReading.h" template std::ostream& operator<<(std::ostream& out, std::vector& values) { out << "[ "; for (const auto& value : values) { out << "\t" << value << ", "; } out << "]"; return out; } int main() { std::vector data; for (auto i = 0; i < 1000; i++) { data.push_back(generateRandomTemperatureReading()); } // TODO: summarize and print out the average temperature for each city in the list } 

Sample Output:

Boise average = 19.8913 San Francisco average = 20.3512 Seattle average = 21.2016 Los Angeles average = 20.6981 Portland average = 20.0572 Miami average = 20.8474 New York average = 19.2552 Boston average = 17.6194 Dallas average = 22.9515 Atlanta average = 18.2082 San Diego average = 20.6528 Detroit average = 22.1643 Las Vegas average = 21.3691 Houston average = 21.1285

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions