Question
Basketball Statistics - C++ Points scored by 10 players on a basketball team, for 7 games in a season, are stored in a file named
Basketball Statistics - C++
Points scored by 10 players on a basketball team, for 7 games in a season, are stored in a file named game_data.txt in the format shown below.
A 10x7 array. 10 rows, 7 columns. 10 players, 7 games.
12 8 6 11 14 18 16
21 18 12 12 17 20 22
etc.
Write a program to read the file into a 2D array of integers, then calculate and display the following statistics for the data:
The average points scored by game (column averages).
The average points scored by player (row averages).
The average points scored per player, per game for the season (average of elements in the array).
The program should be modular. You should have separate functions for input (read file) and output (show calculated stats), with 3 separate functions to calculate each statistic. Your output should be well-organized, neat, and easy to read.
Validate your input; print an error message and set the item to 0 if it is less than 0 or greater than 100.
Step 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