*Need in C language also need full documentation/explanation of each line* Thank you! Write a program that records...

60.1K

Verified Solution

Question

Programming

*Need in C language also need full documentation/explanationof each line*
Thank you!

Write a program that records high-score data from a simulatedFIFA soccer game available online. The program will ask the user toenter the number of scores, create two dynamic arrays sizedaccordingly, ask the user to enter the indicated number of namesand scores, and then print the names and scores sorted by score indescending order.
The output from your program should look exactly like this(given the same inputs in bold):
How many FIFA scores will you enter?: 5
Enter the name for Player #1: Ronaldo
Enter the score for FIFA scorer #1: 10400
Enter the name for Player #2: Didier
Enter the score for FIFA scorer #2: 9800
Enter the name for Player #3: Pele
Enter the score for scorer #3: 12300
Enter the name for Player #4: Kaka
Enter the score for scorer #4: 8000
Enter the name for Player #5: Cristiano
Enter the score for scorer #5: 8400
Top Scorers:
Pele: 12300
Ronaldo: 10400
Didier: 9800
Cristiano: 8400
Kaka: 8000

Process returned 0 (0x0) execution time : 23.997s
Press any key to continue.

Additional Requirements
The data must be stored in two dynamic arrays: an array ofstrings named names, and an array of ints named scores. Thesearrays must be declared and allocated using \"new\" in the mainfunction.
The user input of the names and scores should be done in afunction named readData() and should include appropriate inputvalidation. It should have the following signature:
void readData(string names[], int scores[], int size) // voidfunction for user input to be stored in two arrays
You must also write two more functions: one to sort botharrays in descending order by score, and one to display the finallist of names and scores. They should have the followingsignatures.
void sortData(string names[], int scores[], int size) // voidfunction with a descending sort on multiple arrays
void displayData(const string names[], const int scores[], intsize) // void function displays content from two arrays
The main function should be very short. It should just get thenumber of scores, allocate the two arrays, invoke these threefunctions, and then deallocate the arrays.
Some of you may not have studied selection sorting algorithmsin the Gaddis text Chapter 8 or reviewed the selection sortalgorithm covered in the lesson notes from the array review module.You may use as much code from the Gaddis sort algorithms as youlike but first make sure to understand and trace the sort and thenecessary swaps made or you may use our own algorithm. You may useC++'s built-in swap() function, but do not use C++'s sort()function.

Answer & Explanation Solved by verified expert
4.3 Ratings (712 Votes)
include includeincludeusing namespace    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students