Question: write a C + + program that will process a data set of information for the 2 0 2 3 - 2 0 2 4
write a C program that will process a data set of information for the season of the Chicago Blackhawks. The information in the file will be needed for later processing, so it will be stored in a set of arrays that will be displayed, sorted, and displayed again For the assignment, use six arrays, each of which will hold a maximum of elements: one array of strings to hold the name of each of the players one array of characters to hold the position played by each of the players one array of integers to hold the number of games played for each of the players one array of integers to hold the number of goals scored for each of the players one array of integers to hold the number of assists for each of the players one array of integers to hold the plusminus rating for each of the players The six arrays will be parallel arrays. This means that the information for one player can be found in the same "spot" in each array. This also means that any time information is moved in one array the same move must be made to the other arrays in order to maintain data integrity. Basic Program Logic Declare the six arrays and an integer variable to hold the number of players. If any other variables are needed, declare them as well. Fill the six arrays by calling the build function. The function returns the number of players that it put into an array. This returned value should be saved in the integer variable that holds the number of players. Display the number of players that played for the Blackhawks during the season. Display the six arrays by calling the print function. Make sure to pass a title similar to "Chicago Blackhawks Player Stats Unsorted", the six arrays, and the number of players the integer value returned from the build call Sort the arrays by calling the sort function. Make sure to pass the six arrays and the number of players. Finally, display the six arrays a second time by calling the print function a second time. This time use a title similar to "Chicago Blackhawks Player Stats Sorted". The input for this program will be read from a file named hockey.txt The file consists of a set of player records. Each record represents one player and is made up of six values that are contained on two lines of the file: the first line contains the players name; the second line contains the position code, the number of games played, the number of goals scored, the number of assists, and the plusminus rating for the player. int build string playerNames char position int gamesPlayed int goals int assists int rating This function will read the file of data and fill the six arrays. It takes as its arguments an array of strings to hold the names of the players, an array of characters to hold the positions played by each player, and four arrays of integers to hold the number of games played, number of goals scored, number of assists, and plusminus ratings for the players. It returns the number of players that were placed in the arrays. The function should start by declaring any variables that are needed. At a minimum, there should be an integer variable to hold incoming integer values, a character variable to hold the incoming character value, a string variable to hold the incoming string value, an integer to count the number of players read from the input file, and an input file stream. Next, the function should attempt to open the input file and verify that it opened correctly. Now that the file has been opened correctly, it's time to read the information, one value at a time. Use the getline function described above to read the first player name from input file into the string variable. In a loop that executes as long as there is information, put the string value that was read into the array of strings, read the remaining input values for the player the position, games played, goals scored, assists, and plusminus rating and put them into the corresponding arrays, update the integer variable that holds the number of players to reflect that a player's information was placed in the arrays, use the ignore function to clear the input file stream, and read the next player name from the input file. Finally, once all the data has been read from the file, close the file and return the number of players that were placed in the arrays. void print string title, string playerNames char position int gamesPlayed int goals int assists int rating int numplayers This function will display the information for the players. It takes as its arguments the title for the display, the six arrays to be displayed and the number of players in the arrays. It returns nothing. For each player, display the player name, the position that the player plays, the number games played, number of goals scored, number of assists, number of points, and plusminus rating.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
