Create a program that:
- Prompts the user to input values for an array of five integers
- HINT: It helps your programming flow a LOT if you call the same function used in part 2.g
- Displays a menu, where the user may choose
- Sum Calculates and displays the sum of numbers in the array
- Use this definition (with reference variable as parameter):
- void Sum(int array[], int & result)//stores sum in result
- Mean Calculates and displays the average of numbers in the array. Should not round.
- Should not be an integer! ii. Should use the Sum function defined above
- Display Displays the current values held in the array
- Alternatively, you can just display it at the start of the menus prompt
- Sequencing Displays the difference between each adjacent set of values
- Ie if we had {3, 5, 2, 9, 0}, we would get the output 2 -3 7 -9
- This just needs to be printed, not saved
- Search Indicate whether the users chosen value is contained in the array, or not (boolean result should be returned, ie bool function).
- Sort Arrange the values within the array so that they are in ascending order.
- Bubble or Selection sort will be relevant
- Extra Credit for BOGO sort (google/wiki)
- Edit The user is re-prompted for input into the array (all elements)
- Exit terminate the program
- Sum Calculates and displays the sum of numbers in the array
- Loop back to step 2
There should be at least 4 functions used in this program, including the function definition provided to you. The argument should be the array itself in most of these functions.
You should probably use a global const int for array size. Do not use global variables unless theyre constants!
Reviews
There are no reviews yet.