Question: I'm having problems with finishing the code we started in class. I'm not a CS major, so I'm too invested in expending a lot of

I'm having problems with finishing the code we started in class. I'm not a CS major, so I'm too invested in expending a lot of time to finish this up. Any help will be appreciated.

#include #include

using namespace std;

const int NUM_PLAYERS = 25; const int MAX_COLS = 6; // Number of categories in players statistics

void get_average(int [][MAX_COLS], int, int [], int ); void get_min_index(int [][MAX_COLS], int, int [], int );

int main() { int pscores[NUM_PLAYERS][MAX_COLS]; int avg[MAX_COLS]; // Array passed as argument to get_average. Avg values are stored in this array int minim[MAX_COLS]; // Array passed as argument to get_min_index. Avg values are stored in this array string pname[NUM_PLAYERS], temp; int i, num, score, min_index; int row, col; ifstream infile;

infile.open("nbastats.txt"); if (!infile){ cout << "Invalid file name "; return -1; } // Skip the header line getline(infile, temp);

// Read the rest of the data and store them in the arrays for (row = 0; row < NUM_PLAYERS; row++){ // ROW BY ROW infile >> pname[row]; // First read the player name // Now read the stats for the player read above for (col = 0; col < MAX_COLS; col++){ infile >> pscores[row][col]; } }

// call the functions to calculate average and min for each category get_average(pscores, NUM_PLAYERS, avg, MAX_COLS ); get_min_index(pscores, NUM_PLAYERS, minim, MAX_COLS );

// Write the code to display the result

}

void get_average(int scores[][MAX_COLS], int s_size, int avg[], int a_size ) { // This function should calculate the average of each category of players statistics // Store the results in avg[] // s_size contains the number of rows of scores[][] // a_size is the size of avg[] //write your code below

}

void get_min_index(int scores[][MAX_COLS], int s_size, int minimum[], int m_size ) { // This function should find the index of the minimum value in each category of players statistics // Store the results in minimum[] // s_size contains the number of rows of scores[][] // m_size is the size of avg[] // Write you code below

}

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!