## klfrancisco

I am in introduction to c++ and I have a homework problem that I am trying to do. The problem states display the average high temperature and average low temperature. The program should also display the highest temperature stored in the first column in the array and the lowest temperature stored in the second column. My program runs but it only does 1 day at a time and that is it. How do I get it to show the average and all 7 days?

## klfrancisco

``````This is what I have so far

`#include <iostream>
#include <iomanip>
using namespace std;

//function prototype
void calcAverage(double temperatures[6][1]);

main()

{

double temperatures[7][2] = {0};

double high = 0.0;
double low = 0.0;
double high_average = 0.0;
double low_average = 0.0;

cout << "Please enter the high then low for the last 7 days " <<endl;

for(int x = 0; x < 6; x += 1)
{
cout << "Please enter the High for day: "<< x+1<<": ";
cin >> high;
temperatures[0][x] = high;
}
for(int x = 0; x < 6; x += 1)
{
cout << "Please enter the Low for day: "<< x+1<<": ";
cin >> low;
temperatures[1][x] = high;
}
void calcAverage(double high_average);

system("pause");
return 0;
}

void calcAverage(double temperatures[6][1])
{
double high_average;
double low_average;
float accumulator = 0.0;
//for hot average
for(int x = 0; x < 6; x += 1)
{
accumulator += temperatures[0][x];
}
high_average = accumulator;

// for cold average
accumulator = 0.0;
for(int x = 0; x < 6; x += 1)
{
accumulator += temperatures[1][x];
}
low_average = accumulator;
}`
``````