Write a menu driven program that will feature five functions.

My professor gave us this hard code to but I do not have the slightest idea on how to do it! Could you guys just help get me started?
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).


Implementing binary search to find the value (remember, the data file they specify must be sorted or binary search may not always work). Prompt the user to enter the value to find.


Hey man i have the same problem as you. Can you help me?
Hey man i have the same problem as you. Can you help me?

Yes I can help you. Just wondering what is your problem?
well when I search for my problem it sent me right to this post.

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.



Any answers for this program?
I suggest you guys look take a look at

http://www.cplusplus.com/doc/tutorial/files/ to get started on how to read and write into text files
Thanks dude. Any other examples?
anyone with a solution?
This forum likes to see some effort on behalf of the OP (which incidentally you're not) first before trying to help with the final solution
Topic archived. No new replies allowed.