Hi,
I have a text file with two columns: date and grades. I want to read in the file and bubble sort the data by either date or grades. What I've done is to read the data from the file and put them into two parallel arrays. I did that because the data types are different. Now I'm trying to use the bubble sort function and spit out the output into a "final.txt" file.
I have several questions:
1. I want to convert the date from a string into long. Does the atol command work in class?
2. The sorting doesn't seem to work. Is it because I have the data into two separate arrays ? If so, do I need to combine the two arrays into a single array and use the function? I'm confused. Please help. The code is below.
1. You mean like, a being a Class, calling atol(a)? If you do, then no. If you mean calling atol("2008-09-11"), then that won't work, either. 2. See http://en.wikipedia.org/wiki/Bubble_sort (Never mind.)
2. No. Just pass the other array and swap its i and i+1 elements.