Question: #include using namespace std; void fill _ array ( int arr [ ] , int size ) { cout < < Enter < <
#include using namespace std; void fillarrayint arr int size cout "Enter size elements:
; for int i ; i size; i cin arri; void printarrayint arr int size for int i ; i size; i cout arri; if i cout endl; if size cout endl; New line at the end if not printed yet int linearsearchint arr int size, int key for int i ; i size; i if arri key return i; Return index of the first occurrence return ; If not found void selectsortint arr int size for int i ; i size ; i int minIndex i; for int j i ; j size; j if arrj arrminIndex minIndex j; if minIndex i swaparri arrminIndex; Swap the found minimum element with the first element void insertsortint arr int size for int i ; i size; i int key arri; int j i ; while j && arrj key arrj arrj; j j ; arrj key; void bubblesortint arr int size for int i ; i size ; i for int j ; j size i ; j if arrj arrj swaparrj arrj ; Swap if the element found is greater void menu cout "Menu:
; cout Linear Search
; cout Selection Sort
; cout Insertion Sort
; cout Bubble Sort
; cout Exit
; int main int choice; int a; do menu; cout "Enter your choice: ; cin choice; switchchoice case : fillarraya; cout "Enter the key you want to search: ; int key; cin key; int index linearsearcha key; ifindex cout "The key key is not in array
; else cout "The key key is #index element in array
; break; case : fillarraya; selectsorta; cout "After sort, the array is:
; printarraya; break; case : fillarraya; insertsorta; cout "After sort, the array is:
; printarraya; break; case : fillarraya; bubblesorta; cout "After sort, the array is:
; printarraya; break; case : cout "Thank you for using the array functions
; break; default: cout "Wrong choice. Please choose from menu: ; break; whilechoice ; return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
