Question: In this lab you will get a chance to explore names w/ Vectors. You will need to create two vectors of strings, one for first

In this lab you will get a chance to explore names w/ Vectors. You will need to create two vectors of strings, one for first names, and one for last names. You will then read in first and last names and place these into vectors. See example below: done = false; while(!done){ // Prompt user with "Enter First Name: " getline(cin, firstName); if (!firstName.empty()){ // Add to vector of First Names // Prompt user with "Enter Last Name: " getline(cin, lastName); // Add to vector of Last Names // Print out First Name and Last Name ending with newline (endl) } else { done = true; } } You will not know how many names will be entered, and will need to use vector functions to add strings into your vector. After reading both the first name and last name, print the first name and last name separated by a space with a newline. You will then sort the list of names using the selection sort we described in class. You will need to make some changes in order to sort on last name first, then first name. Below's basic loop for our Selection Sort : for (i=0; i>Enter First Name: david >>Enter Last Name: ruby david ruby >>Enter First Name: ej >>Enter Last Name: smith ej smith >>Enter First Name: arlene >>Enter Last Name: kova arlene kova >>Enter First Name: --Sorted Names-- arlene kova david ruby ej smith

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!