- Create a menu driven application that receives input from a textfile called “Numbers.txt” and loads the numbers into an array. It will also calculate the sum, save numbers to file, and allow the user to modify a number. The application should have the following functions:
void ReadNumbers(string filepath, int numbers[], int length); - 10pts
Define a function that sequentially reads each number from the textfile and loads them into the array.
void DisplayNumbers(int numbers[], int length); - 10pts
Define a function that displays all the numbers stored in the array.
int CalculateSum(int numbers[], int length); - 10pts
Define a function that calculates the sum of all numbers in the array and returns the sum.
void ChangeNumbers(int numbers[]); - 10pts
Define a function that allows the user to modify one of the numbers in the array.
Ask the user for the index of the number that needs to be changed
Ask them for the input.
Assign the new number to array at the index specified by the user
void WriteNumbers(string filepath, int numbers[], int length); - 10pts
Define a function that writes each number from the array into the textfile. Write one number per line.
void DisplayMenu(); - 10pts
Display the following text:
int main() should do the following (include comments explaining your code for 10 pts)
1. Declare all variables for sum and choice. – 3pts
2. Declare a named constant for the length of the array with an assigned value of 10 – 3pts
3. Declare variable for the filepath – 0pts
4. Declare an integer array for the numbers using the named constant as the size declarator. – 3pts
5. Call the ReadNumbers function to load the array – 3pts
6. Display the menu – 3pts
7. Get choice from the user -3pts
8. Clear the screen – 0pts
9. Based a. b. c. d. e.
10. pause
11. While
on the user’s choice, call the appropriate function. -6pts
case 1: Call DisplayNumbers function
case 2: Call CalculateSum fuction and display the sum
case 3: Call Display Numbers and ChangeNumbers functions case 4: Call WriteNumbers
case 5: exit(1)
screen - system(“pause”) – 0pts
choice does not equal 5, repeat steps 6 to 10 – 6pts