Instructions Write a program in C++ that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and the highest and lowest temperatures for the year. Your program must consist of the following functions: Function getData: This function reads and stores data in the two-dimensional array. Function averageHigh: This function calculates and returns the average high temperature for the year. Function averageLow: This function calculates and returns the average low temperature for the year. Function indexHighTemp: This function returns the index of the highest high temperature in the array. Function indexLowTemp: This function returns the index of the lowest low temperature in the array. These functions must all have the appropriate parameters. An example of the program is shown below: Enter high temperature for each month 60 68 72 72 73 76 80 81 75 72 67 66 Enter low temperature for each month 40 52 55 57 56 60 61 63 69 68 51 62 Average high temperature: 71 Average low temperature: 57 Highest temperature: 81 Lowest temperature: 40
Instructions
Write a
- Function getData: This function reads and stores data in the two-dimensional array.
- Function averageHigh: This function calculates and returns the average high temperature for the year.
- Function averageLow: This function calculates and returns the average low temperature for the year.
- Function indexHighTemp: This function returns the index of the highest high temperature in the array.
-
Function indexLowTemp: This function returns the index of the lowest low temperature in the array.
These functions must all have the appropriate parameters.
An example of the program is shown below:
Enter high temperature for each month 60 68 72 72 73 76 80 81 75 72 67 66 Enter low temperature for each month 40 52 55 57 56 60 61 63 69 68 51 62 Average high temperature: 71 Average low temperature: 57 Highest temperature: 81 Lowest temperature: 40
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images