Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions