Thursday, July 30, 2009

How to sort a record in c++ using bubble sort?

I have record/struct variable which contains student first name, last name,student's course grade their age and GPA. I want to sort it with respect to GPA using bubblesort. but when I get done


only GPA field is sorted . But other fields are the same.


so GPA doesnot corresponds to right student. any suggestion that when GPA is SORTED all related members should also go in proper places.

How to sort a record in c++ using bubble sort?
nested for loops
Reply:it is just like the bubble that comes to the top of water


you just have to check each value in th array(GPA) with the succeding one and and swap all the entries corespondin to that gpa if needed to get a proper sorted list


1 comment:

  1. yes it worked and to add it more quality you could include databases.

    ReplyDelete