I'm writing a Sorting program that prompts the user to enter a filename and then opens the file. It will read the comment from the first line and also read an integer N from the second line. It then reads N integers from the rest of the file and puts them into consecutive locations in an array. Once it does all this the program will then write the name of the input file and will sort an identical copy of the array using selection sort and merge sort(two classes that I have already. it finally writes a report of the number of compares and moves done in each sort and then asks the user if he wishes to continue.
My program as of right now asks the user for the text file and prints out whats inside. I'm having trouble with where i need it to write the name of the input file and will sort an identical copy of the array using selection sort and merge sort. I also am having trouble making it write the report of the number of compares and moves done in each sort.
This is what my program is supposed to look like when it outputs:
Enter Filename: ord50
File Name: ord50
File Comment: This is an ordered list of 50 numbers.
selection sort starting ... done
merge sort starting ... done
Here are the results of the sorts:
selection sort 1225 147
merge sort 153 572
How can i go about making my program print like this?
Here's my code so far, i have three classes; driver class, mergesort class, and selection class.