One possibility would be to use the C strtok() function to separate the strings out into the first and last names:
That isn't a very 'clean' way of doing it if you ask me - too much mixing of C with C++ for my liking. You could alternatively use the istream::getline() method. but parsing the string using strtok is probably the single easiest way of doing it.
/* Assume the first and last name is stored within a C++ string, temp_str */
temp_ptr = strtok(temp_str.c_str(), " \n");
/* temp_ptr points to first name */
temp_ptr = strtok(NULL, " \n");
/* temp_ptr now points to surname */
Once you have the individual first and last names of a person, shuffling them is easy.