Array Manipulation Hint: the answer should need to link together with a c code and output In this question, you develop a code capable of doing array manipulation. Your program will have the following menu. This code should be completely modular so that for each of the menu options (except for probably a couple of them) a function should be called. 1- Enter the size of the array 2- Enter the array elements 3- Sort the array 4- Find a number within the array 5- Print the array 6- Reverse print the array 7- Quit
-
Array Manipulation
Hint: the answer should need to link together with a c code and output
In this question, you develop a code capable of doing array manipulation. Your program will have the following menu. This code should be completely modular so that for each of the menu options (except for probably a couple of them) a function should be called.
1- Enter the size of the array
2- Enter the array elements
3- Sort the array
4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
A sample run of the program is as follows:
1- Enter the size of the array
2- Enter the array elements
3- Sort the array
4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
Please enter your choice: 0
That’s not a valid choice
Please enter your choice: 2
You should first set the size of the array
1- Enter the size of the array
2- Enter the array elements
3- Sort the array
4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
Please enter your choice: 3
Your array is not initialized yet!
1- Enter the size of the array
2- Enter the array elements
3- Sort the array
4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
Please enter your choice: 4
Your array is not initialized yet!
1- Enter the size of the array
2- Enter the array elements
3- Sort the array 4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
Please enter your choice: 1
What is the size of your array (1-20)? 25
Array size should be between 1 and 20
What is the size of your array (1-100)? 8
Array size set
1- Enter the size of the array
2- Enter the array elements
3- Sort the array
4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
Please enter your choice: 3
Your array is not initialized yet!
1- Enter the size of the array
2- Enter the array elements
3- Sort the array
4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
Please enter your choice: 2
Enter array element 1: 0
Enter array element 2: -2
Enter array element 3: 7
Enter array element 4: 4
Enter array element 5: 3.5
Enter array element 6: 9.4
Enter array element 7: 1.9
Enter array element 8: 202
Array elements have been received
1- Enter the size of the array
2- Enter the array elements
3- Sort the array
4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
Please enter your choice: 3
Sorting the array.
Please choose Ascending/Descending (A/D)? M
That’s not a valid choice
Please choose Ascending/Descending (A/D)? A
Array sorted (Ascending)
-2 0 1.9 3.5 4 7 9.4 202
1- Enter the size of the array
2- Enter the array elements
3- Sort the array
4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
Please enter your choice: 4
Please enter a number to be searched in the array: 5
5 was not found in the array
1- Enter the size of the array
2- Enter the array elements
3- Sort the array
4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
Please enter your choice: 4
Please enter a number to be searched in the array: 7
7 was found at the position 6 in the array
1- Enter the size of the array
2- Enter the array elements
3- Sort the array
4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
Please enter your choice: 5
Printing the array
-2 0 1.9 3.5 4 7 9.4 202
1- Enter the size of the array
2- Enter the array elements
3- Sort the array
4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
Please enter your choice: 6
Reverse printing the array
202 9.4 7 4 3.5 1.9 0 -2
1- Enter the size of the array
2- Enter the array elements
3- Sort the array
4- Find a number within the array
5- Print the array
6- Reverse print the array
7- Quit
Please enter your choice: 7
Thanks and bye!
Step by step
Solved in 3 steps with 3 images