In this tutorial you will first learn about sorting, i.e. how to sort vectors and arrays. After that, you will also learn how to read from a file and write to a file using C++.
The easiest way to sort any container is with the sort() function from the algorithm library, which takes two arguments. First argument is the beginning address (container.begin()) of the container and second argument is the ending address (container.end()). Remember, this function doesn't return any value. Calling the sort function modifies the original container and the elements are arranged in sorted order.
The general syntax for sorting is:
sort(start address, end address)start address = the address of the first element of the array / vectorend address = the address of the last element of the array / vector