Write a menu driven program that will feature five functions? HELP PLEASE

Write a menu driven program that will feature five functions.

(1) Write void function/subroutine that prompts the user for the name of a file to output as a text file that will hold a vector of the float data type.

A) Have the user specify the number of items that will be stored in the vector.
B) Have the user enter the values for each element in the vector.
C) Write the vector out as a text file. You will want the file format to be as follows: the first data value is the number of elements in the vector, and the remaining data is to be the elements of the vector.

(2) Write void function/subroutine like #1, except in this time, instead of asking the user for the values for each element in the vector, have the program create randomly generated values for the elements using the rand() function. You will still have to ask the user for the number of elements to store in the vector. Write the vector out as a text file. You will want the file format to be as follows: the first data value is the number of elements in the vector, and the remaining data is to be the elements of the vector.

(3) Write a void function/subroutine to prompt the user for the name of a file to input as a text file to read. The first value the subroutine reads in should be the number of elements to store in the vector. All other data read in from the subroutine should be the floating point data in the file to store in the vector.

Output the contents of the vector to the screen.

(4) Write a void function/ subroutine to prompt the user for the name of a file to input as a text file to read in the vector of float data type and another filename for the name of the output file that will be outputting the vector after it has been sorted using either the bubblesort or selection sort algorithm (Five points extra credit if you study how to do recursion and use merge sort! Warning: this is a very challenging endeavor if you take it on).

Load in the data for the vector (make sure the first data value read in is the value stating how many elements are to be in the vector, and remaining data is the elements to be stored in the vector).

Before sorting, ask the user if they would like to sort from smallest value to largest, or to sort from largest value to smallest value.

Sort the vector based on the sorting order the user specifies, and output the sorted vector to the output filename specified by the user.

(5) Write a void function/subroutine to prompt the user for the name of a file to input as a text file to read in the vector of float data type.

Load in the data for the vector (make sure the first data value read in is the value stating how many elements are to be in the vector, and remaining data is the elements to be stored in the vector).

So … what is your question?

1 Like

There is no question, there is an assignment: “Do the homework for me”.

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at http://freecodecamp.com.

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

It is pretty typical on here for people to share a codepen / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.

Please provide some example of what you’ve tried and I’m sure you’ll get more help.

Happy coding :slight_smile: