Wait, if you're using C++, why are you using qsort() when you can use std::sort()?
You'll probably want to write a function that takes two Cables, gets the costs from them, and return the order in which they (the elements) should go in the form of a boolean. std::sort() can take a function to replace the < operator (if it exists). http://cplusplus.com/reference/algorithm/sort/
Thanks for this. It doesn't really matter what i use, but i'm having trouble constructing the comparator, and would like some guidance on building that
The problem is that the qsort comparator should return a negative number if elem1 is less than elem2, zero if both elements are equal and a positive number if elem1 is greater than elem2.