Program Requirements:
Let A be an array of n elements. Write a template function that takes an unsorted array of type <class T> as an input parameter and feeds back a sorted array via the input parameter. Assume the operators < and > are defined for the class T. In this question, you may hardcode n=5. You must write all functions you call, and also needs to write a main() to test the following data arrays stored in a data file (data.txt):
1 9 3 4 6
4 1 9 3 6
1.1 4.1 3.1 5.2 6.3
t d b e f
I have got my program to run but the output only shows me this:
The initial list is 1 9 3 4 6
The sorted list is
Can anyone help me fix this problem. I think that my SortedList function is correctly set up but I am not sure why it is not giving me the correct output. I was hoping you guys could locate any of my errors or give me any advice. This is my first time learning templates so any help would be appreciated. Thanks
I revised my code and the output looks better but it is only showing me the sorted list of the first line in the text file. The output looks like this:
The sorted list is 1 3 4 6 9
I need help trying to get my program to read in the other lines 3 lines and print out the sorted list of each of them.
Once again, it doesn't work, because you don't make it work. You close the flie, pause and exit the program inside the while loop that was supposed to read the other lines. Move those lines outside the loop and it might work..