Question: Make a flow chart for the following code: #include #include #include #include using namespace std; void getData(int array [12][2], ifstream& infile); double averageHigh (int array

Make a flow chart for the following code:

#include #include #include #include using namespace std; void getData(int array [12][2], ifstream& infile); double averageHigh (int array [12][2]); double averageLow (int array [12][2]); int indexHighTemp (int array [12][2], ofstream& outfile); int indexLowTemp (int array [12][2], ofstream& outfile); int main() { int array [12][2]; int high; int low; ifstream infile; ofstream outfile; infile.open("E:\\program6input.txt"); outfile.open("E:\\program6ouput.txt"); outfile << "Daniel" <

infile.close();

outfile.close();

system("pause");

}

void getData (int array[12][2], ifstream& infile)

{

int x;

int y;

for(x=0; x<12; x++)

{

for(y=0; y<2; y++)

{

infile >> array[x][y];

}

}

}

double averageHigh (int array [12][2])

{

double avg;

double sum;

int x;

int y;

avg = 0;

sum = 0;

for (x = 0; x<12; x++)

{

{

sum = sum + array[x][0];

}

}

avg = sum / x;

return avg;

}

double averageLow (int array[12][2])

{

double avg2;

double sum2;

int x;

int y;

avg2=0;

sum2=0;

for (x=0; x<12; x++)

{

{

sum2 = sum2 + array[x][1];

}

}

avg2 = sum2 /x;

return avg2;

}

int indexHighTemp (int array[12][2], ofstream& outfile) {

int highest; int x; int y; int xx; int yy; highest = array[0][0];

for (x=0; x<12; x++)

{

for (y=0; y<2; y++)

{

if (highest < array[x][y])

{

highest =array[x][y]; xx=x; yy=y;

} }

}

outfile << setw(18) << left << "High Temp Index:"<< "[" << xx << ","<< yy<< "]" << endl;

return highest;

}

int indexLowTemp (int array[12][2], ofstream& outfile)

{

int lowest;

int x;

int y;

int xx;

int yy;

lowest = array[0][0];

for (x=0; x<12; x++)

{

for (y=0; y<2; y++)

{

if (lowest > array[x][y])

{

lowest = array[x][y];

xx = x;

yy = y;

}

}

}

outfile << setw(18) << left << "Low Temp Index:" << "[" << xx << "," << yy <<"]" << endl;

return lowest;

}

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!