Question: C++ Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. You should also

C++

Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. You should also have a parallel array to store the names of the 12 months. The program should read the Months names, and the temperatures from a given input file called temps.txt. The program should output the highest and lowest temperatures for the year, and the months that correspond to those temperatures. Your program MUST use the following functions: 1. Function loadData: The function reads and stores data in the parallel array and 2D array from a text file (temps.txt). loadData(ifstream &infile, string months[], int temp[][2], int &rows); 2. Function averageHigh: This function calculates and returns the high temperature and the corresponding month of the year. averageHigh(string months[], int temp[][2], int rows, string &month, int &hightemp); 3. Function averageLow: This function calculates and returns the low temperature and the corresponding month of the year. averageLow(string months[], int temp[][2], int rows, string &month, int &lowtemp); Design Considerations Please use a while loop to read all lines of text from input file. Keep the input file in the same directory as your project.

the file is:

January 47 36 February 51 37 March 57 39 April 62 43 May 69 48 June 73 52 July 81 56 August 81 57 September 75 52 October 64 46 November 52 41 December 45 35

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!