Using the following array:
//may be declared outside of the main function
const int NUM_Games =4;
//may only be declared within the main function
int scores[NUM_GAMES] = {122, 76, 92, 143};
Write a C++ program to run a menu-driven program with thefollowing choices:
1) Display the scores
2) Change a score
3) Display game with the highest score
4) Display a sorted list of the scores
5) Quit
- Write a function called getValidScore that allows a user toenter in an integer and loops until a valid number that is>= 0and <= 150 is entered. It returns the valid value.
- Write a function called getValidGameNumber that allows a userto enter in an integer and loops until a valid number that is>=1 and <= NUM_GAMES. It returns the valid value.
- Write a function called displayScores that takes the scorearray as a parameter and displays the scores in the format in thesample run below.
- void displayScores(int scores[NUM_GAMES]);
- Write a function called ChangeAScore that takes the score arrayas a parameter, it allows the user to enter in a valid score and avalid game, It then stores the score under the selected game in thescores array.
- void ChangeAScore(int scores[NUM_GAMES]);
- Write a function called displayGameHighestScore that takes thescore array as a parameter, it displays the number of the game withthe highest score. Note: array elements are 0 to 2 but the gamenumbers are 1 to 5.
- //displays the number of the game with the highest score
- void displayGameHighestScore(int scores[NUM_GAMES]);
- Write a function called displaySortedScores that takes thescores array as a parameter, it creates a local copy of the scoresarray, sorts the new array in descending order and displays valuesin the new array. You can use either bubble or selection sort.
- void displaySortedScores(int scores[NUM_GAMES]);
Sample Run:
Welcome to the Gaming Program!
1) Display the scores
2) Change a score
3) Display game with the highest score
4) Display a sorted list of the scores to the menu
5) Quit
Select an option (1..4)..1
Display scores
Game 1Â Â Â Â Â Â Â Â Â Â Game 2Â Â Â Â Â Â Â Â Â Â Game 3Â Â Â Â Â Â Â Â Â Â Game4
  122                 76                  92                    143
1) Display the scores
2) Change a score
3) Display game with the highest score
4) Display a sorted list of the scores to the menu
5) Quit
Select an option (1..4)..2
Change a score
Please enter in the game number …
20
Please enter in a valid game number …
2
Please enter in the score ...
135
1) Display the scores
2) Change a score
3) Display game with the highest score
4) Display a sorted list of the scores to the menu
5) Quit
Select an option (1..4)..3
The game with the highest score is 4
Select an option (1..4)..4
Sorted list of scores
143Â Â Â Â Â 135Â Â Â Â Â 122Â Â Â Â Â 92
Select an option (1..4)..5