Got no clue how to do this.

array basics


summary

in this lab, you complete a partially prewritten c++ program that uses an array.


the program prompts the user to interactively enter eight batting averages, which the program stores in an array. the program should then find the minimum and maximum batting average stored in the array as well as the average of the eight batting averages. the data file provided for this lab includes the input statement and some variable declarations. comments are included in the file to help you write the remainder of the program.


instructions

ensure the source code file named battingaverage.cpp is open in the code editor.


write the c++ statements as indicated by the comments.


execute the program by clicking the run button. enter the following batting averages: .299, .157, .242, .203, .198, .333, .270, .190. the minimum batting average should be .157, and the maximum batting average should be .333. the average should be .2365.


#include

#include

using namespace std;


int main()

{

// declare a named constant for array size here



// declare array here



// use this integer variable as your loop index

int loopindex;


// use this variable to store the batting average input by user

double battingaverage;


// use these variables to store the minimim and maximum values

double min, max;


// use these variables to store the total and the average

double total, average;


// write a loop to get batting averages from user and assign to array


cout << "enter a batting average: ";

cin >> battingaverage;

// assign value to array


// assign the first element in the array to be the minimum and the maximum

min = averages[0];

max = averages[0];

// start out your total with the value of the first element in the array

total = averages[0];

// write a loop here to access array values starting with averages[1]


// within the loop test for minimum and maximum averages.


// also accumulate a total of all averages




// calculate the average of the 8 batting averages



// print the batting averages stored in the averages array


// print the maximum batting average, minimum batting average, and average batting average


return 0;

}