Question: Please write in C++ 1. Given a data set with 1000 TemperatureReading objects, count and print out the number of data entries for the city

Please write in C++

1. Given a data set with 1000 TemperatureReading objects, count and print out the number of data entries for the city "Seattle". You may not use a raw-loop to 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()); } std::cout << data << " "; // TODO: print out the number of items in data that correspond to 'Seattle' } 

Sample Output:

... Temp(id='997', city='Portland', value='2.30648'), Temp(id='998', city='Seattle', value='26.6842'), Temp(id='999', city='New York', value='21.7007'), ] There are 65 entries for 'Seattle'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!