### READ,STORE, AND SORT IN ASCENDING ORDER

As you could understand from the title, I'm really a novice in this programming environment. I'd like to ask you for help: I need to read a file like:

11:02,11:06
15:45,16:05
...
These data are one above the other one. So we have 11 columns (11 characters plus newline) and 239 rows. In the original file they are all sorted randomly. I should sort them in ascending order. At the end, it would be nice of course to visualize the output. So far, I have done the first step, I'm reading the file "char by char". But I can't proceed further; my knowledge doesn't permit me that. I would be really glad if someone could help me. I really need this stuff.

I tried a bit by myself, but I don't know how to proceed. For example, once the data is ridden with a class called "readfile", how can i store it in another class called "storefile"? and then how to take the array just created and then sort it in ascending order with another class called "sortfile"?
Is this a good way to proceed? can anybody help me please?

Cheers
I Do Not Understand? Do You Need HelpWith A Code Or Document?
well, in programming there isn't a column and a row, there's only a string of characters.
if you don't know a lot about file i/o:
http://www.cplusplus.com/doc/tutorial/files/

i have an algorithm, don't load the whole file into your program, just load it one value at a time, you're gonna need a function that eases random access to the file.
store the value in a vector or something you're comfort with.
Algorithm:
1- find the largest value in the file, store a copy of it in an object cur_largest.
2- find next_largest, the value that is bigger than all except cur_largest.
3- cur_largest = next_largest
4- write cur_largest.
5- repeat steps 2-4 until you finish with the input file.

hope that was useful.
there are also lots of fast sorting algorithms, you just need to implement them for dealing with this file.
try shell sort:
http://en.wikipedia.org/wiki/Shellsort
quick sort:
http://en.wikipedia.org/wiki/Quicksort

as i mentioned, you have to implement the algorithm for your specific file.
Topic archived. No new replies allowed.