Your mission: Write a program to determine statistics for a video game tournamen
ID: 3641271 • Letter: Y
Question
Your mission: Write a program to determine statistics for a video game tournament. The user will input names and scores of all tournament players. The program will calculate the average score and display the players who scored below average.The program will implement these functions:
Main(): Declares variables for the number of players and average score, and two arrays of size 100: one to store player names and the other to store their respective scores. Calls the following functions in sequence, passing necessary parameters by reference:
InputData( ): Gets player names and scores from the user and stores them into the two arrays for an unknown number of players up to 100.
DisplayPlayerData(): Displays each player's name and score.
CalculateAverageScore( ): Calculates the average score and returns it by value.
DisplayBelowAverage( ): Displays the names and scores of players who scored below average.
Sample output:
Enter Player Name (Q to quit): Bob
Enter score for Bob: 3245
Enter Player Name (Q to quit): Sue
Enter score for Sue: 1098
Enter Player Name (Q to quit): Dave
Enter score for Dave: 8219
Enter Player Name (Q to quit): Pat
Enter score for Pat: 3217
Enter Player Name (Q to quit): Q
Name Score
Bob 3245
Sue 1098
Dave 8219
Pat 3217
Average Score: 3944.75
Players who scored below average
Name Score
Bob 3245
Sue 1098
Pat 3217
Press any key to continue . . .
Explanation / Answer
#include #include #include using namespace std; const int ARRAY_SIZE = 100; void inputData(); void playerData(); double calcAvgScore(); void displayBelowAvg(); void main() { } void inputData() { string playerName; while () cout > playerName; } void playerData() { } double calcAverageScore() { } void displayBelowAvg() { }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.