Question: Rewrite your League program from Assignment 5 so that it uses Dynamic Memory Allocation ( DMA ) to create the team names and scores arrays.
Rewrite your League program from Assignment so that it uses Dynamic Memory Allocation DMA to create the team names and scores arrays.
This is a good test of the modularity of your program. You will only need to make slight modifications to your main function if you wrote your original program using functions similar to the following:
void initializeDatastring names int wins int size
void sort string names int wins int size
void displaystring names int wins int size
Your modified league program should start out by asking the user how many teams will be entered. It should then dynamically allocate two appropriate arrays, and proceed just like the original League assignment, calling the above three functions. When your program is done using the arrays, don't forget to use delete to return their memory to the system.
Note: you must use dynamic memory allocation for your arrays, ie the new and delete operators, to receive credit.
The output from your program should look approximately like this user input in orange bold:
How many teams will you enter?:
Enter team #: Padres
Enter the wins for team #:
Enter team #: Dodgers
Enter the wins for team #:
Enter team #: Giants
Enter the wins for team #:
Enter team #: Cubs
Enter the wins for team #:
League Standings:
Giants:
Dodgers:
Padres:
Cubs:
#include
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
