Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions