Write a program that uses a two dimensional array to store the highest and lowes
ID: 3640151 • Letter: W
Question
Write a program 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. the program must consist of the following functions, getdata - reads and stores data in the 2D array, averageHigh- calculates and returns the avg high temp for the year, averageLow- calculates and returns the avg low temp for the year, index hightemp- returns the index of the highest temp, indexlowtemp- returns the index of the lowest temp in the array.This function needs all appropriate parameters. I need this in C++ language please. Someone answered this question already but the program does not work.
Explanation / Answer
#include 002 #include 003 #include 004 005 006 const int rows = 12; //make # of rows/cols a constant int 007 const int cols = 2; 008 009 010 using namespace std; 011 012 void getData( int listTemp[rows][cols]); 013 void averageHigh( int listTemp[rows][cols]); 014 void averageLow(int listTemp[rows][cols]); 015 void indexHighTemp(int listTemp[rows][cols]); 016 void indexLowTemp( int listTemp[cols][cols]); 017 018 ifstream infile; 019 ofstream outfile; 020 021 int main() 022 { 023 024 025 // ofstream outfile; 026 double average; 027 int listTemp[rows][cols]; 028 029 030 infile.open("E:\jackson_lab3input.txt"); //open infile 031 outfile.open("E:\jackson_lab3output.txt"); 032 033 outfileRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.