Using stl sort
Never write your own sort! Use the the sort in the Standard Template Library (STL). The STL has sorts that are efficient and well tested.
Basic syntax for calling sort When calling the STL sort, you need to pass two parameters: the address of the first element to sort, and the address of one past the last element to sort. The address is used for iterating across array elements. For other data structures (eg, a vector) you will have to do something a little different, but for arrays we can simply express the beginning and ending points with the array name and the addition of an integer.
[Read More]