Question: #include #include #include #include #include #include int main() LyStep 1 - create the map 1. Create a std: :map that uses a city name as

 #include #include #include #include #include #include int main() LyStep 1 -create the map 1. Create a std: :map that uses a city

#include #include #include #include #include #include int main() LyStep 1 - create the map 1. Create a std: :map that uses a city name as the key; for the value type, use vector. The vector associated with each city will hold the temperatures forthat city, 2. Open the le "CityTemps . txt" for input. 3. For each line, get the city and the temperature. and add that list of temperatures for that city. You may take advantage of the fact that referring to a non-existent entry in the map (that is, a key with no corresponding value) will cause that entry to be created with a default-constructed value. (In other words, your input loop doesn't need to do anything special to handle the rst temperature reading for a given city.) Step 2 - compute and print the averages For each city, compute the average temperature and print it. Hint: Recall that iterating over the entries in a map provides a std: main- object for each entry in which the First eld is the key, and the second eld is the value

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 Programming Questions!