At this point in the course we’ve studied both vectors and arrays, and have had some exposure to sort algorithms.
Save your time - order a paper!
Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlinesOrder Paper Now
Write a program that reads a list of names from the provided file in this module —— and stores them into a vector of strings. The file contains randomly generated last names only.
Using one of the sort algorithms we discussed in Chapter 8 — selection sort or bubble sort, your choice — sort the vector in ascending order. No special comparisons are needed for strings, you can simply use the ‘>’ or ‘<‘ operator to compare (for example, the string “abc” will be less than (<) “def” when compared).
After sorting the vector, output the first 5 and last 5 names in the sort.
For a review of how vectors work, read Section 7.11 of the text (p. 435 – 448, with a good reference table on page 448).
Your program should output exactly the following:
First 5 names:
Last 5 names: