Sorting in a file stored by C++

Status
Not open for further replies.

real_in

In Runtime
Messages
277
hi guys,

I am making a small assistant for my mother(she is a teacher). she wants to record students details with their names,marks,%age,roll no etc etc.

So i am haff way to it, i am able to store all data and retrieve it, but i am just unable to sort the records.

is it possible in any case. like there are just 60 students arranged roll number wise, but now they have got variable marks, suppose i need to display them according to the highest marks, is it possible in file??

i know its pretty easy using MSaccess or mysql, but i want to do it in C++. please help me if there is anyother way, like any other datastructure :)

thanks guys..
 
I believe there's an implementation of QuickSort in the C++ STL. If you want to implement your own sorting algorithm, search "sorting algorithms" at wikipedia.org and implement one that runs in O(n log n) or less, which is only possible with certain data sets. However, using a database would probably be a better approach.
 
but i cannot use database with C++ i believe, can i ??

If it's your own program, then you know what the format of the .txt or .dat or w/e file will be. Use a quick sort, merge sort, or insertion sort with a object called student with a doubly ended linklist.
 
Status
Not open for further replies.
Back
Top Bottom