![]() |
|
#1
|
|||
|
|||
Sorting an array of structsHello, I am in need of serious help for this assignment. The program calls to read and write data from a in file to an out file. The program does that successfully. I need help adding the sort array function for the "lnames", "exams", "avg" that is inside the struct Grades. Here is the code.
CPP / C++ / C Code:
The input file is studinfo.txt and here it is. Code:
|
|||
|
#2
|
|||
|
|||
Re: help with sorting an array of structsWell, you could just supply operator< to struct Grades. Then you could do something like
CPP / C++ / C Code:
__________________
My personal site: Utilities for text processing, debugging, testing and plotting |
|
#3
|
|||
|
|||
Re: Sorting an array of structsCan't do that haha. The sorting part has to have its owns function like
void sortArray or along those lines. I can't decide how to do it. Which do you prefer is easier bubble or selection sort? |
|
#4
|
|||
|
|||
Re: Sorting an array of structsGiven
CPP / C++ / C Code:
CPP / C++ / C Code:
__________________
My personal site: Utilities for text processing, debugging, testing and plotting |
|
#5
|
|||
|
|||
Re: Sorting an array of structsHmm...Okay well in the comments of your answer what would I put? do i put a for statement? If i do can i get an example as a way to sort it from low to high? Sorry if i am annoying, but im bad with sorting functions lol.
|
Recent GIDBlog
Install Adobe Flash - Without Administrator Rights by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| where is the problem and can you fix it (php) | oggie | MySQL / PHP Forum | 8 | 14-Apr-2008 15:08 |
| Getting a line error in register | oggie | MySQL / PHP Forum | 5 | 13-Apr-2008 16:16 |
| How to sort in C++ alphabetically | wilen | C++ Forum | 5 | 20-Apr-2007 14:43 |
| Need help deleting the last element in the array | headphone69 | C++ Forum | 2 | 15-Mar-2006 19:31 |
| sorting a two-dimensional array using qsort | Hyuga | C Programming Language | 20 | 24-Aug-2005 08:10 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The