I did it like this and it somewhat works but I have problem with the middle name such as Barrack Hussein Obama. How do I make it so it ignores the middle name and just gives me the last name???
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
string name;
string first_name, last_name;
char response;
do{
cout << "Enter your full name: ";
cin >> first_name; cin >> last_name; // get their full name, including spaces.
// display last name
cout << "\t" <<first_name << " "<< last_name << ", your last name is " << last_name << endl;
cout << "CONTINUE(y/n)? ";
cin >> response;
cin.ignore(50, '\n');
} while(response == 'Y' || response=='y') ;
system ("pause");
return 0;
}