Question: Final: Write a program with functions: IN C++ 1-Show a menu in a loop with these following options to get the elements of an array:

Final: Write a program with functions: IN C++

1-Show a menu in a loop with these following options to get the elements of an array:

a.Option 1: To enter manually: Ask user to enter the elements of an array. User can enter as many as they want until they enter Q or qto end.

i.Store the created array in a variable

ii.Print the created array with the name of the variable.

b.Option 2: To read from a file: You program should read a file to get the elements of the array. Prepare a text file with some integers.

i.Store the created array in a variable

ii.Print the created array with the name of the variable.

c.Option 3: To exit of this menu

2-Show a menu in a loop with these following options:

a.Option 1: Bubble sort: Choose this one to sort the first array (which entered manually). Print the array after sorting.

b.Option 2: Selection sort: Choose this one to sort the first array (which read from a file). Print the array after sorting.

c.Option 3: Exit of this menu

3-Show a menu in a loop with these followingoptions:

a.Option 1: Linear search: Ask user to enter an array (enter the first array) and a value to search in the array. Show if it found the value or not. If found how many of the value are in the array.

b.Option 2: Binary search: Ask user to enter an array (enter the secondarray) and a value to search in the array. Show if it found the value or not. If found how many of the value are in the array.

c.Option 3: Exit of this menu4-Write the sorted arrays in a file. (Ask user to enter the name of the file)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!