Question
In c++ programing , complete this assigment. The instructions are given in the first picture, I will also post the code that needs to be
In c++ programing , complete this assigment. The instructions are given in the first picture, I will also post the code that needs to be edited , along with the text file needed to complete the program. Please follow all insturctions in first picture, thank you.
Instructions :
Code that needs to be edited :
#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
// Read the rest of the data and store them in the arrays for (row = 0; row > pname[row]; // First read the player name // Now read the stats for the player read above for (col = 0; col > 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
}
--------------------------------------------------------------------------------------------------------------------------------
nba.txt text file that may be needed (not 100% needed):
Name age Points Rebound Steals Blocks PF Oladipo 25 23 2 3 0 1 Richardson 24 10 3 2 0 0 Beal 24 14 3 2 0 2 George 27 16 2 1 1 2 Lillard 27 24 7 3 0 1 James 33 37 10 1 0 3 Young 32 9 3 1 0 3 Antetokounmpo 23 25 10 1 0 3 Bogdanovic 28 18 8 0 0 1 McCollum 26 34 4 1 0 2 Lowry 32 11 6 1 0 3 Prince 24 28 6 2 0 0 Hill 31 17 4 2 1 2 Middleton 26 19 7 2 1 2 Young 29 22 9 5 3 5 Westbrook 29 23 8 4 0 6 Adams 24 18 10 0 2 2 Satoransky 26 9 4 3 1 4 Dragic 31 9 4 2 0 4 Rozier 24 33 5 5 0 1 Hardaway 26 11 4 3 0 1 Cook 25 17 4 1 1 1 Williams 31 26 2 1 1 1 Rivers 25 11 1 4 0 2 Bogdanovic 25 4 1 3 0 2
For this assignment, you need to complete the program we wrote, during class, for calculating average and minimum values of the various categories (points, rebounds, steal, etc.). They are all listed in the input file: nbastats.txt. The partially completed source file playerstats.cpp and the input file are in the shared directory. Specifically, you need to write the code for the two function: void get_average (int [] [MAX_COLS], int, int, int); void getminindex (int [ ] [MAX. COLS], nt, nt, int); - - Additionally, you need write the code for displaying the results in the main function. Understand the program well before you start coding. Notice how a two dimensional array is declared in the header and prototype of the functions. Please submit your source code (no need to submit the input file) to eLearningStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started