Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Sorting in a file stored by C++
Closed Thread
Old 06-26-2007, 12:54 PM   #1 (permalink)
 
Super Techie

Join Date: Aug 2004

Posts: 277

real_in

Send a message via Yahoo to real_in
Post Sorting in a file stored by C++

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..
__________________
Realin Wuz here ...

real_in is offline  
Old 06-26-2007, 02:19 PM   #2 (permalink)
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default Re: Sorting in a file stored by C++

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.
jaeusm is offline  
Old 06-26-2007, 10:57 PM   #3 (permalink)
 
Super Techie

Join Date: Aug 2004

Posts: 277

real_in

Send a message via Yahoo to real_in
Default Re: Sorting in a file stored by C++

but i cannot use database with C++ i believe, can i ??
__________________
Realin Wuz here ...

real_in is offline  
Old 07-10-2007, 01:31 PM   #4 (permalink)
OnlyCurious's Avatar
 
Ultra Techie

Join Date: Dec 2004

Posts: 611

OnlyCurious

Send a message via AIM to OnlyCurious Send a message via Yahoo to OnlyCurious
Default Re: Sorting in a file stored by C++

Quote:
Originally Posted by real_in View Post
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.
__________________
Use my advice at your own risk.

My rig:
CoolerMaster Centurion 5
SamSung 20" LCD
Intel E6750 @ 2.66Ghz
Gigabyte p35-ds3r
Patriot Extreme 2gb 4-4-4-12
Sapphire X1950XT 256mb
Samsung 500gb @ 7200
PSU Xclio GreatPower 550W
Samsung DVD Burner
Logitec X-230 2.1
OnlyCurious is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Another Hijack Log boo HijackThis Logs (finished) 17 06-26-2007 12:30 PM
my log Max Power HijackThis Logs (finished) 10 06-07-2007 11:56 PM
Objecterror HJT Log objecterror Virus - Spyware Protection / Detection 4 05-18-2007 12:19 PM
Batch file steak1986 Windows Operating Systems and Software 6 04-11-2007 06:03 PM
Having trouble getting a downloaded file Bendersterrier Browser & General Internet Questions 1 03-28-2007 12:42 PM