Question: needs to be in C++ coding sample run: Enter the number of elements you want to enter (Max 100): 5 Enter 5 numbers 2.5 6
needs to be in C++ coding
sample run:
Enter the number of elements you want to enter (Max 100): 5
Enter 5 numbers
2.5 6 -7 10.7 0.8
1. Insert an element
2. Remove an element
3. Print an element
4. Sort the array
3
5. Exit
Enter your option: 1
Enter the number: 3.1
Enter the position: 2
Element Inserted.
1. Insert an element
2. Remove an element
3. Print an element
4. Sort the array
5. Exit
Enter your option: 3
The array is:
2.5 6 3.1 -7 10.7 0.8
1. Insert an element
2. Remove an element
3. Print an element
4. Sort the array
5. Exit
Enter your option: 4
1. Insert an element
2. Remove an element
3. Print an element
4. Sort the array
5. Exit
Enter your option: 3
The array is:
-7 0.8 2.5 3.1 6 10.7
1. Insert an element
2. Remove an element
3. Print an element
4. Sort the array
5. Exit
Enter your option: 2
Enter the element: 0.8
Element deleted.
1. Insert an element
2. Remove an element
3. Print an element
4. Sort the array
5. Exit
Enter your option: 3
The array is:
-7 2.5 3.1 6 10.7
4
1. Insert an element
2. Remove an element
3. Print an element
4. Sort the array
5. Exit
Enter your option: 5
Goodbye

these tasks repcatedly. For this problem, you can assume that the array size will never drop below 1 and will never rise above 99 Please make sure you conform to the following requirements: 1. Create a global constant integer called CAPACITY and set it to 100 (5 points 2. Use the class examples and exercises to write functions to initialize the array by reading values from the user, and to print the array. These functions take the array and its current size as 3. Write a function called insert that takes the array, a number, a position and the current size 4. Write a function called remove that takes the array, a number and the current size of the rite a function called sort that takes the array and its current size as parameters and sorts parameters. You can use the code in the examples. (5 points) of the array as parameters. Insert the number at the given position. (15 points) array, and removes the first instance of the number from the array. (15 points) the array in ascending order. You need to use insertion sort, which is given below. (15 points) 6. In the main function, have the user initialize the array. Then, write a command line menu with the following options: Print Insert Remove Sort Exit Call the appropriate functions when the user chooses a particular option. Print and error message and continue if the user enters a wrong option. (15 points) 7. Please make sure your code is appropriately commented. (5 points) Algorithm for insertion sort loop i from 1 to Length(A)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
