Problem

This project is an extension of Programming Project 4.16. Consider a text file named score...

This project is an extension of Programming Project 4.16. Consider a text file named scores.txt that contains player scores for a game. A possible sample is shown next where Ronaldo’s best score is 10400, Didier’s best score is 9800, etc. Put at least five names and scores in the file.

Write a function named getHighScores that takes two array parameters, an array of strings and an array of integers. The function should scan through the file and set the string array entry at index 0 to the name of the player with the highest score and set the integer array entry at index 0 to the score of the player with the highest score. The string array entry at index 1 should be set to the name of the player with the second highest score and the integer array entry at index 1 should be set to the score of the player with the second highest score. Do the same for the entries at index 2. Together, these two arrays give you the names and scores of the top three players. In your main function, test the getHighScores function by calling it and outputting the top three players and scores.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 5