Question: Using C + + , Write a program that stores 2 0 names in a vector of strings, rather than in an array of strings.

Using C++, Write a program that stores 20 names in a vector of strings, rather than in an array of strings. Create the vector without specifying a size and then use the push_back member function to add an element holding each string to the vector. The data should be read in from a file. Instead of assuming there are always 20 strings, read in the strings and add them to the vector until there is no data left in the file. The data can be found in the attached names.txt file. Once the names are read in, the names should be sorted. Display the original list of names and then the sorted list of names.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!