An exercise with
vectors and strings

Fill in the blanks in this code that inputs a user's first name and last name, creates and saves the users full name in a vector of strings in the format "last, first" and then prints the names. #include <iostream> #include <string> #include <vector> using namespace std; int main ( ) { // sentinel value const string QUIT = "quit"; string firstName, lastName, fullName; ______________ allNames; // input names until sentinel name entered cout << "Please input your first name:"; cin >> ___________________; while ( firstName != ___________ ) { cout << "Please input your last name:"; cin >> lastName; // concatentate last/first names to form full name fullName = _______________________________________; // save full name allNames.________________( fullName ); // get a new first name cout << "Please input your first name:"; cin >> firstName; } // print the names for (unsigned int i = 0; i < ___________________; i++) cout << ___________________ << endl; return 0; }


Last Modified: Monday, 28-Aug-2006 10:16:07 EDT