Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write in C++ 2. Given a data set with 1000 TemperatureReading objects, copy all of the temperature readings that are greater than 39 degrees

Please write in C++

2. Given a data set with 1000 TemperatureReading objects, copy all of the temperature readings that are greater than 39 degrees Celcius into a second list and print out that list. 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()); } // TODO: create a list of temperatures > 30 and print out this list. } 

Sample Output:

[ Temp(id='22', city='Detroit', value='39.0835'), Temp(id='29', city='Dallas', value='39.6233'), Temp(id='94', city='Houston', value='39.6568'), Temp(id='100', city='Houston', value='39.9926'), Temp(id='107', city='Las Vegas', value='39.1519'), Temp(id='220', city='New York', value='39.9882'), Temp(id='283', city='Detroit', value='39.0821'), Temp(id='287', city='Detroit', value='39.5706'), Temp(id='384', city='Houston', value='39.6586'), Temp(id='386', city='Detroit', value='39.1191'), Temp(id='393', city='Detroit', value='39.3869'), Temp(id='492', city='Atlanta', value='39.4127'), Temp(id='522', city='Dallas', value='39.7759'), Temp(id='560', city='Boise', value='39.9824'), Temp(id='577', city='Boston', value='39.5289'), Temp(id='630', city='Detroit', value='39.3428'), Temp(id='678', city='Boston', value='39.0348'), Temp(id='738', city='New York', value='39.5177'), Temp(id='756', city='San Francisco', value='39.2621'), Temp(id='767', city='Atlanta', value='39.9365'), Temp(id='776', city='New York', value='39.6162'), Temp(id='785', city='Houston', value='39.8002'), Temp(id='800', city='Boston', value='39.2553'), Temp(id='837', city='Miami', value='39.7505'), Temp(id='844', city='San Diego', value='39.9677'), Temp(id='864', city='San Diego', value='39.088'), ]

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_2

Step: 3

blur-text-image_3

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

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago