Question: 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,

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

Hi, I need help with my programming assignment and the automatic grading keeps telling me it's wrong can anyone check my code? thank you in advance.

  1. Ensure the source code file named BattingAverage.cpp is open in the code editor.

  2. Write the C++ statements as indicated by the comments.

  3. 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.

(The code)

#include #include using namespace std; int main() { //Float array float batting_averages[8]; int i; float min,max; float sum=0.0; for (i=0;i<8;i++) { cout<<"Enter batting average"; cin>>batting_averages[i]; } cout<<"Entered batting averages are"<batting_averages[i]) { //Smaller value will be assigned in min min=batting_averages[i]; } } cout<<" Maximum batting average is "<

}

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!