TeamSheet Owns a new[] Array of Players
mediumQuestion 696Player is already written in the starter code - leave it as is. Write the class TeamSheet, which owns a heap-allocated array of Player objects (not an array of pointers).
Private members:
- Player* players;
- int count;
Public interface used by the hidden driver:
TeamSheet(int n); // allocate n Player objects with new[]; set every jersey and points to 0
~TeamSheet(); // release the array
void setPlayer(int index, int jersey, int points);
int pointsOf(int index) const;
int topJersey() const; // jersey of the player with the most points; on a tie, the LOWEST index winsThe driver reads n, then n lines of jersey points, then prints three lines.
For the input:
3
7 10
23 14
9 14the exact output is what is shown in Expected Output.
Free the memory you allocate — this question checks for memory leaks.
Do NOT write a main function.
Expected output
players=3 points[1]=14 top=23
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
Pointers
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.